Socket
Socket
Sign inDemoInstall

puppeteer-core

Package Overview
Dependencies
93
Maintainers
2
Versions
221
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 21.1.0 to 21.1.1

47

lib/cjs/puppeteer/api/ElementHandle.d.ts

@@ -19,8 +19,6 @@ /**

import { Frame } from '../api/Frame.js';
import { CDPSession } from '../common/Connection.js';
import { ExecutionContext } from '../common/ExecutionContext.js';
import { WaitForSelectorOptions } from '../common/IsolatedWorld.js';
import { ElementFor, EvaluateFuncWith, HandleFor, HandleOr, NodeFor } from '../common/types.js';
import { KeyInput } from '../common/USKeyboardLayout.js';
import { KeyPressOptions, MouseClickOptions, KeyboardTypeOptions } from './Input.js';
import { KeyboardTypeOptions, KeyPressOptions, MouseClickOptions } from './Input.js';
import { JSHandle } from './JSHandle.js';

@@ -31,7 +29,11 @@ import { ScreenshotOptions } from './Page.js';

*/
export type Quad = [Point, Point, Point, Point];
/**
* @public
*/
export interface BoxModel {
content: Point[];
padding: Point[];
border: Point[];
margin: Point[];
content: Quad;
padding: Quad;
border: Quad;
margin: Quad;
width: number;

@@ -115,3 +117,3 @@ height: number;

*/
export declare class ElementHandle<ElementType extends Node = Element> extends JSHandle<ElementType> {
export declare abstract class ElementHandle<ElementType extends Node = Element> extends JSHandle<ElementType> {
#private;

@@ -165,13 +167,12 @@ /**

*/
dispose(): Promise<void>;
asElement(): ElementHandle<ElementType>;
remoteObject(): Protocol.Runtime.RemoteObject;
/**
* @internal
*/
executionContext(): ExecutionContext;
dispose(): Promise<void>;
asElement(): ElementHandle<ElementType>;
/**
* @internal
* Frame corresponding to the current handle.
*/
get client(): CDPSession;
get frame(): Frame;
abstract get frame(): Frame;
/**

@@ -392,5 +393,4 @@ * Queries the current element for an element matching the given selector.

* // DO NOT DISPOSE `element`, this will be always be the same handle.
* const anchor: ElementHandle<HTMLAnchorElement> = await element.toElement(
* 'a'
* );
* const anchor: ElementHandle<HTMLAnchorElement> =
* await element.toElement('a');
* ```

@@ -404,6 +404,7 @@ *

/**
* Resolves to the content frame for element handles referencing
* iframe nodes, or null otherwise
* Resolves the frame associated with the element, if any. Always exists for
* HTMLIFrameElements.
*/
contentFrame(): Promise<Frame | null>;
abstract contentFrame(this: ElementHandle<HTMLIFrameElement>): Promise<Frame>;
abstract contentFrame(): Promise<Frame | null>;
/**

@@ -424,3 +425,3 @@ * Returns the middle point within an element unless a specific offset is provided.

*/
click(this: ElementHandle<Element>, options?: ClickOptions): Promise<void>;
click(this: ElementHandle<Element>, options?: Readonly<ClickOptions>): Promise<void>;
/**

@@ -578,3 +579,3 @@ * This method creates and captures a dragevent from the element.

*/
assertElementHasWorld(): asserts this;
abstract assertElementHasWorld(): asserts this;
/**

@@ -605,3 +606,3 @@ * If the element is a form input, you can use {@link ElementHandle.autofill}

*/
autofill(data: AutofillData): Promise<void>;
abstract autofill(data: AutofillData): Promise<void>;
}

@@ -608,0 +609,0 @@ /**

@@ -118,2 +118,8 @@ "use strict";

*/
remoteObject() {
return this.handle.remoteObject();
}
/**
* @internal
*/
async dispose() {

@@ -126,17 +132,2 @@ return await this.handle.dispose();

/**
* @internal
*/
executionContext() {
throw new Error('Not implemented');
}
/**
* @internal
*/
get client() {
throw new Error('Not implemented');
}
get frame() {
throw new Error('Not implemented');
}
/**
* Queries the current element for an element matching the given selector.

@@ -411,5 +402,4 @@ *

* // DO NOT DISPOSE `element`, this will be always be the same handle.
* const anchor: ElementHandle<HTMLAnchorElement> = await element.toElement(
* 'a'
* );
* const anchor: ElementHandle<HTMLAnchorElement> =
* await element.toElement('a');
* ```

@@ -431,11 +421,20 @@ *

/**
* Resolves to the content frame for element handles referencing
* iframe nodes, or null otherwise
* Returns the middle point within an element unless a specific offset is provided.
*/
async contentFrame() {
throw new Error('Not implemented');
async clickablePoint(offset) {
const box = await this.#clickableBox();
if (!box) {
throw new Error('Node is either not clickable or not an Element');
}
if (offset !== undefined) {
return {
x: box.x + offset.x,
y: box.y + offset.y,
};
}
return {
x: box.x + box.width / 2,
y: box.y + box.height / 2,
};
}
async clickablePoint() {
throw new Error('Not implemented');
}
/**

@@ -447,6 +446,15 @@ * This method scrolls element into view if needed, and then

async hover() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().mouse.move(x, y);
}
async click() {
throw new Error('Not implemented');
/**
* This method scrolls element into view if needed, and then
* uses {@link Page | Page.mouse} to click in the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
async click(options = {}) {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint(options.offset);
await this.frame.page().mouse.click(x, y, options);
}

@@ -532,12 +540,20 @@ async drag() {

async tap() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().touchscreen.touchStart(x, y);
await this.frame.page().touchscreen.touchEnd();
}
async touchStart() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().touchscreen.touchStart(x, y);
}
async touchMove() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().touchscreen.touchMove(x, y);
}
async touchEnd() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
await this.frame.page().touchscreen.touchEnd();
}

@@ -555,8 +571,125 @@ /**

}
async type() {
throw new Error('Not implemented');
/**
* Focuses the element, and then sends a `keydown`, `keypress`/`input`, and
* `keyup` event for each character in the text.
*
* To press a special key, like `Control` or `ArrowDown`,
* use {@link ElementHandle.press}.
*
* @example
*
* ```ts
* await elementHandle.type('Hello'); // Types instantly
* await elementHandle.type('World', {delay: 100}); // Types slower, like a user
* ```
*
* @example
* An example of typing into a text field and then submitting the form:
*
* ```ts
* const elementHandle = await page.$('input');
* await elementHandle.type('some text');
* await elementHandle.press('Enter');
* ```
*
* @param options - Delay in milliseconds. Defaults to 0.
*/
async type(text, options) {
await this.focus();
await this.frame.page().keyboard.type(text, options);
}
async press() {
throw new Error('Not implemented');
/**
* Focuses the element, and then uses {@link Keyboard.down} and {@link Keyboard.up}.
*
* @remarks
* If `key` is a single character and no modifier keys besides `Shift`
* are being held down, a `keypress`/`input` event will also be generated.
* The `text` option can be specified to force an input event to be generated.
*
* **NOTE** Modifier keys DO affect `elementHandle.press`. Holding down `Shift`
* will type the text in upper case.
*
* @param key - Name of key to press, such as `ArrowLeft`.
* See {@link KeyInput} for a list of all key names.
*/
async press(key, options) {
await this.focus();
await this.frame.page().keyboard.press(key, options);
}
async #clickableBox() {
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const boxes = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
return [...element.getClientRects()].map(rect => {
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
});
});
void adoptedThis.dispose().catch(util_js_1.debugError);
if (!boxes?.length) {
return null;
}
await this.#intersectBoundingBoxesWithFrame(boxes);
let frame = this.frame;
let element;
while ((element = await frame?.frameElement())) {
try {
element = await element.frame.isolatedRealm().transferHandle(element);
const parentBox = await element.evaluate(element => {
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
return {
left: rect.left +
parseInt(style.paddingLeft, 10) +
parseInt(style.borderLeftWidth, 10),
top: rect.top +
parseInt(style.paddingTop, 10) +
parseInt(style.borderTopWidth, 10),
};
});
if (!parentBox) {
return null;
}
for (const box of boxes) {
box.x += parentBox.left;
box.y += parentBox.top;
}
await element.#intersectBoundingBoxesWithFrame(boxes);
frame = frame?.parentFrame();
}
finally {
void element.dispose().catch(util_js_1.debugError);
}
}
const box = boxes.find(box => {
return box.width >= 1 && box.height >= 1;
});
if (!box) {
return null;
}
return {
x: box.x,
y: box.y,
height: box.height,
width: box.width,
};
}
async #intersectBoundingBoxesWithFrame(boxes) {
const { documentWidth, documentHeight } = await this.frame
.isolatedRealm()
.evaluate(() => {
return {
documentWidth: document.documentElement.clientWidth,
documentHeight: document.documentElement.clientHeight,
};
});
for (const box of boxes) {
intersectBoundingBox(box, documentWidth, documentHeight);
}
}
/**

@@ -567,3 +700,28 @@ * This method returns the bounding box of the element (relative to the main frame),

async boundingBox() {
throw new Error('Not implemented');
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const box = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
});
void adoptedThis.dispose().catch(util_js_1.debugError);
if (!box) {
return null;
}
const offset = await this.#getTopLeftCornerOfFrame();
if (!offset) {
return null;
}
return {
x: box.x + offset.x,
y: box.y + offset.y,
height: box.height,
width: box.width,
};
}

@@ -579,4 +737,128 @@ /**

async boxModel() {
throw new Error('Not implemented');
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const model = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
const offsets = {
padding: {
left: parseInt(style.paddingLeft, 10),
top: parseInt(style.paddingTop, 10),
right: parseInt(style.paddingRight, 10),
bottom: parseInt(style.paddingBottom, 10),
},
margin: {
left: -parseInt(style.marginLeft, 10),
top: -parseInt(style.marginTop, 10),
right: -parseInt(style.marginRight, 10),
bottom: -parseInt(style.marginBottom, 10),
},
border: {
left: parseInt(style.borderLeft, 10),
top: parseInt(style.borderTop, 10),
right: parseInt(style.borderRight, 10),
bottom: parseInt(style.borderBottom, 10),
},
};
const border = [
{ x: rect.left, y: rect.top },
{ x: rect.left + rect.width, y: rect.top },
{ x: rect.left + rect.width, y: rect.top + rect.bottom },
{ x: rect.left, y: rect.top + rect.bottom },
];
const padding = transformQuadWithOffsets(border, offsets.border);
const content = transformQuadWithOffsets(padding, offsets.padding);
const margin = transformQuadWithOffsets(border, offsets.margin);
return {
content,
padding,
border,
margin,
width: rect.width,
height: rect.height,
};
function transformQuadWithOffsets(quad, offsets) {
return [
{
x: quad[0].x + offsets.left,
y: quad[0].y + offsets.top,
},
{
x: quad[1].x - offsets.right,
y: quad[1].y + offsets.top,
},
{
x: quad[2].x - offsets.right,
y: quad[2].y - offsets.bottom,
},
{
x: quad[3].x + offsets.left,
y: quad[3].y - offsets.bottom,
},
];
}
});
void adoptedThis.dispose().catch(util_js_1.debugError);
if (!model) {
return null;
}
const offset = await this.#getTopLeftCornerOfFrame();
if (!offset) {
return null;
}
for (const attribute of [
'content',
'padding',
'border',
'margin',
]) {
for (const point of model[attribute]) {
point.x += offset.x;
point.y += offset.y;
}
}
return model;
}
async #getTopLeftCornerOfFrame() {
const point = { x: 0, y: 0 };
let frame = this.frame;
let element;
while ((element = await frame?.frameElement())) {
try {
element = await element.frame.isolatedRealm().transferHandle(element);
const parentBox = await element.evaluate(element => {
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
return {
left: rect.left +
parseInt(style.paddingLeft, 10) +
parseInt(style.borderLeftWidth, 10),
top: rect.top +
parseInt(style.paddingTop, 10) +
parseInt(style.borderTopWidth, 10),
};
});
if (!parentBox) {
return null;
}
point.x += parentBox.left;
point.y += parentBox.top;
frame = frame?.parentFrame();
}
finally {
void element.dispose().catch(util_js_1.debugError);
}
}
return point;
}
async screenshot() {

@@ -683,13 +965,12 @@ throw new Error('Not implemented');

}
/**
* @internal
*/
assertElementHasWorld() {
(0, assert_js_1.assert)(this.executionContext()._world);
}
autofill() {
throw new Error('Not implemented');
}
}
exports.ElementHandle = ElementHandle;
function intersectBoundingBox(box, width, height) {
box.width = Math.max(box.x >= 0
? Math.min(width - box.x, box.width)
: Math.min(width, box.width + box.x), 0);
box.height = Math.max(box.y >= 0
? Math.min(height - box.y, box.height)
: Math.min(height, box.height + box.y), 0);
}
//# sourceMappingURL=ElementHandle.js.map

@@ -303,2 +303,6 @@ /**

/**
* @internal
*/
frameElement(): Promise<HandleFor<HTMLIFrameElement> | null>;
/**
* Behaves identically to {@link Page.evaluateHandle} except it's run within

@@ -305,0 +309,0 @@ * the context of this frame.

@@ -21,2 +21,3 @@ "use strict";

const GetQueryHandler_js_1 = require("../common/GetQueryHandler.js");
const HandleIterator_js_1 = require("../common/HandleIterator.js");
const LazyArg_js_1 = require("../common/LazyArg.js");

@@ -148,2 +149,22 @@ const util_js_1 = require("../common/util.js");

}
/**
* @internal
*/
async frameElement() {
const parentFrame = this.parentFrame();
if (!parentFrame) {
return null;
}
const list = await parentFrame.isolatedRealm().evaluateHandle(() => {
return document.querySelectorAll('iframe');
});
for await (const iframe of (0, HandleIterator_js_1.transposeIterableHandle)(list)) {
const frame = await iframe.contentFrame();
if (frame._id === this._id) {
return iframe;
}
void iframe.dispose().catch(util_js_1.debugError);
}
return null;
}
async evaluateHandle() {

@@ -150,0 +171,0 @@ throw new Error('Not implemented');

@@ -17,4 +17,2 @@ /**

import Protocol from 'devtools-protocol';
import { CDPSession } from '../common/Connection.js';
import { ExecutionContext } from '../common/ExecutionContext.js';
import { EvaluateFuncWith, HandleFor, HandleOr } from '../common/types.js';

@@ -43,3 +41,3 @@ import { ElementHandle } from './ElementHandle.js';

*/
export declare class JSHandle<T = unknown> {
export declare abstract class JSHandle<T = unknown> {
/**

@@ -58,13 +56,5 @@ * Used for nominally typing {@link JSHandle}.

/**
* @internal
*/
executionContext(): ExecutionContext;
/**
* @internal
*/
get client(): CDPSession;
/**
* Evaluates the given function with the current handle as its first argument.
*/
evaluate<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
abstract evaluate<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
/**

@@ -74,9 +64,8 @@ * Evaluates the given function with the current handle as its first argument.

*/
evaluateHandle<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
abstract evaluateHandle<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
/**
* Fetches a single property from the referenced object.
*/
getProperty<K extends keyof T>(propertyName: HandleOr<K>): Promise<HandleFor<T[K]>>;
getProperty(propertyName: string): Promise<JSHandle<unknown>>;
getProperty<K extends keyof T>(propertyName: HandleOr<K>): Promise<HandleFor<T[K]>>;
abstract getProperty<K extends keyof T>(propertyName: HandleOr<K>): Promise<HandleFor<T[K]>>;
abstract getProperty(propertyName: string): Promise<JSHandle<unknown>>;
/**

@@ -100,3 +89,3 @@ * Gets a map of handles representing the properties of the current handle.

*/
getProperties(): Promise<Map<string, JSHandle>>;
abstract getProperties(): Promise<Map<string, JSHandle<unknown>>>;
/**

@@ -110,3 +99,3 @@ * A vanilla object representing the serializable portions of the

*/
jsonValue(): Promise<T>;
abstract jsonValue(): Promise<T>;
/**

@@ -116,7 +105,7 @@ * Either `null` or the handle itself if the handle is an

*/
asElement(): ElementHandle<Node> | null;
abstract asElement(): ElementHandle<Node> | null;
/**
* Releases the object referenced by the handle for garbage collection.
*/
dispose(): Promise<void>;
abstract dispose(): Promise<void>;
/**

@@ -128,7 +117,7 @@ * Returns a string representation of the JSHandle.

*/
toString(): string;
abstract toString(): string;
/**
* @internal
*/
get id(): string | undefined;
abstract get id(): string | undefined;
/**

@@ -139,4 +128,4 @@ * Provides access to the

*/
remoteObject(): Protocol.Runtime.RemoteObject;
abstract remoteObject(): Protocol.Runtime.RemoteObject;
}
//# sourceMappingURL=JSHandle.d.ts.map

@@ -51,93 +51,4 @@ "use strict";

}
/**
* @internal
*/
executionContext() {
throw new Error('Not implemented');
}
/**
* @internal
*/
get client() {
throw new Error('Not implemented');
}
async evaluate() {
throw new Error('Not implemented');
}
async evaluateHandle() {
throw new Error('Not implemented');
}
async getProperty() {
throw new Error('Not implemented');
}
/**
* Gets a map of handles representing the properties of the current handle.
*
* @example
*
* ```ts
* const listHandle = await page.evaluateHandle(() => document.body.children);
* const properties = await listHandle.getProperties();
* const children = [];
* for (const property of properties.values()) {
* const element = property.asElement();
* if (element) {
* children.push(element);
* }
* }
* children; // holds elementHandles to all children of document.body
* ```
*/
async getProperties() {
throw new Error('Not implemented');
}
/**
* A vanilla object representing the serializable portions of the
* referenced object.
* @throws Throws if the object cannot be serialized due to circularity.
*
* @remarks
* If the object has a `toJSON` function, it **will not** be called.
*/
async jsonValue() {
throw new Error('Not implemented');
}
/**
* Either `null` or the handle itself if the handle is an
* instance of {@link ElementHandle}.
*/
asElement() {
throw new Error('Not implemented');
}
/**
* Releases the object referenced by the handle for garbage collection.
*/
async dispose() {
throw new Error('Not implemented');
}
/**
* Returns a string representation of the JSHandle.
*
* @remarks
* Useful during debugging.
*/
toString() {
throw new Error('Not implemented');
}
/**
* @internal
*/
get id() {
throw new Error('Not implemented');
}
/**
* Provides access to the
* {@link https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject | Protocol.Runtime.RemoteObject}
* backing this handle.
*/
remoteObject() {
throw new Error('Not implemented');
}
}
exports.JSHandle = JSHandle;
//# sourceMappingURL=JSHandle.js.map

@@ -243,5 +243,5 @@ "use strict";

}), (0, rxjs_js_1.mergeMap)(handle => {
return (0, rxjs_js_1.from)(handle.click(options)).pipe((0, rxjs_js_1.catchError)((_, caught) => {
return (0, rxjs_js_1.from)(handle.click(options)).pipe((0, rxjs_js_1.catchError)(err => {
void handle.dispose().catch(util_js_1.debugError);
return caught;
throw err;
}));

@@ -339,5 +339,5 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

}))
.pipe((0, rxjs_js_1.catchError)((_, caught) => {
.pipe((0, rxjs_js_1.catchError)(err => {
void handle.dispose().catch(util_js_1.debugError);
return caught;
throw err;
}));

@@ -354,5 +354,5 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

}), (0, rxjs_js_1.mergeMap)(handle => {
return (0, rxjs_js_1.from)(handle.hover()).pipe((0, rxjs_js_1.catchError)((_, caught) => {
return (0, rxjs_js_1.from)(handle.hover()).pipe((0, rxjs_js_1.catchError)(err => {
void handle.dispose().catch(util_js_1.debugError);
return caught;
throw err;
}));

@@ -376,5 +376,5 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

}
}, options?.scrollTop, options?.scrollLeft)).pipe((0, rxjs_js_1.catchError)((_, caught) => {
}, options?.scrollTop, options?.scrollLeft)).pipe((0, rxjs_js_1.catchError)(err => {
void handle.dispose().catch(util_js_1.debugError);
return caught;
throw err;
}));

@@ -381,0 +381,0 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

@@ -19,2 +19,4 @@ "use strict";

exports.unitToPixels = exports.supportedMetrics = exports.Page = void 0;
const rxjs_js_1 = require("../../third_party/rxjs/rxjs.js");
const Errors_js_1 = require("../common/Errors.js");
const EventEmitter_js_1 = require("../common/EventEmitter.js");

@@ -622,4 +624,25 @@ const NetworkManager_js_1 = require("../common/NetworkManager.js");

}
async waitForFrame() {
throw new Error('Not implemented');
/**
* Waits for a frame matching the given conditions to appear.
*
* @example
*
* ```ts
* const frame = await page.waitForFrame(async frame => {
* return frame.name() === 'Test';
* });
* ```
*/
async waitForFrame(urlOrPredicate, options = {}) {
const { timeout: ms = this.getDefaultTimeout() } = options;
if ((0, util_js_1.isString)(urlOrPredicate)) {
urlOrPredicate = (frame) => {
return urlOrPredicate === frame.url();
};
}
return (0, rxjs_js_1.firstValueFrom)((0, rxjs_js_1.merge)((0, rxjs_js_1.fromEvent)(this, "frameattached" /* PageEmittedEvents.FrameAttached */), (0, rxjs_js_1.fromEvent)(this, "framenavigated" /* PageEmittedEvents.FrameNavigated */), (0, rxjs_js_1.from)(this.frames())).pipe((0, rxjs_js_1.filterAsync)(urlOrPredicate), (0, rxjs_js_1.first)(), (0, rxjs_js_1.raceWith)((0, rxjs_js_1.timer)(ms === 0 ? Infinity : ms).pipe((0, rxjs_js_1.map)(() => {
throw new Errors_js_1.TimeoutError(`Timed out after waiting ${ms}ms`);
})), (0, rxjs_js_1.fromEvent)(this, "close" /* PageEmittedEvents.Close */).pipe((0, rxjs_js_1.map)(() => {
throw new Errors_js_1.TargetCloseError('Page closed.');
})))));
}

@@ -626,0 +649,0 @@ async goBack() {

@@ -31,3 +31,7 @@ /**

WEBVIEW = "webview",
OTHER = "other"
OTHER = "other",
/**
* @internal
*/
TAB = "tab"
}

@@ -34,0 +38,0 @@ /**

@@ -31,2 +31,6 @@ "use strict";

TargetType["OTHER"] = "other";
/**
* @internal
*/
TargetType["TAB"] = "tab";
})(TargetType || (exports.TargetType = TargetType = {}));

@@ -33,0 +37,0 @@ /**

@@ -134,2 +134,6 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void;
/**
* Captures the current state of the accessibility tree.

@@ -136,0 +140,0 @@ * The returned object represents the root accessible node of the page.

@@ -50,2 +50,8 @@ "use strict";

/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
/**
* Captures the current state of the accessibility tree.

@@ -52,0 +58,0 @@ * The returned object represents the root accessible node of the page.

@@ -17,5 +17,3 @@ /**

import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import { AutofillData, ElementHandle as BaseElementHandle, BoundingBox, ClickOptions } from '../../api/ElementHandle.js';
import { KeyPressOptions, KeyboardTypeOptions } from '../../api/Input.js';
import { KeyInput } from '../USKeyboardLayout.js';
import { AutofillData, ElementHandle as BaseElementHandle } from '../../api/ElementHandle.js';
import { Frame } from './Frame.js';

@@ -40,12 +38,4 @@ import { JSHandle } from './JSHandle.js';

autofill(data: AutofillData): Promise<void>;
boundingBox(): Promise<BoundingBox | null>;
click(this: ElementHandle<Element>, options?: Readonly<ClickOptions>): Promise<void>;
hover(this: ElementHandle<Element>): Promise<void>;
tap(this: ElementHandle<Element>): Promise<void>;
touchStart(this: ElementHandle<Element>): Promise<void>;
touchMove(this: ElementHandle<Element>): Promise<void>;
touchEnd(this: ElementHandle<Element>): Promise<void>;
type(text: string, options?: Readonly<KeyboardTypeOptions>): Promise<void>;
press(key: KeyInput, options?: Readonly<KeyPressOptions>): Promise<void>;
contentFrame(this: ElementHandle<HTMLIFrameElement>): Promise<Frame>;
}
//# sourceMappingURL=ElementHandle.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

const ElementHandle_js_1 = require("../../api/ElementHandle.js");
const assert_js_1 = require("../../util/assert.js");
const util_js_1 = require("../util.js");
const JSHandle_js_1 = require("./JSHandle.js");

@@ -64,94 +64,20 @@ /**

}
async boundingBox() {
if (this.frame.parentFrame()) {
throw new Error('Elements within nested iframes are currently not supported.');
}
const box = await this.frame.isolatedRealm().evaluate(element => {
const rect = element.getBoundingClientRect();
if (!rect.left && !rect.top && !rect.width && !rect.height) {
// TODO(jrandolf): Detect if the element is truly not visible.
return null;
async contentFrame() {
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const handle = (await adoptedThis.evaluateHandle(element => {
if (element instanceof HTMLIFrameElement) {
return element.contentWindow;
}
return {
x: rect.left,
y: rect.top,
width: rect.width,
height: rect.height,
};
}, this);
return box;
}
// ///////////////////
// // Input methods //
// ///////////////////
async click(options) {
await this.scrollIntoViewIfNeeded();
const { x = 0, y = 0 } = options?.offset ?? {};
const remoteValue = this.remoteValue();
(0, assert_js_1.assert)('sharedId' in remoteValue);
return this.#frame.page().mouse.click(x, y, Object.assign({}, options, {
origin: {
type: 'element',
element: remoteValue,
},
return;
}));
void handle.dispose().catch(util_js_1.debugError);
void adoptedThis.dispose().catch(util_js_1.debugError);
const value = handle.remoteValue();
if (value.type === 'window') {
return this.frame.page().frame(value.value.context);
}
return null;
}
async hover() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
(0, assert_js_1.assert)('sharedId' in remoteValue);
return this.#frame.page().mouse.move(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async tap() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
(0, assert_js_1.assert)('sharedId' in remoteValue);
return this.#frame.page().touchscreen.tap(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async touchStart() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
(0, assert_js_1.assert)('sharedId' in remoteValue);
return this.#frame.page().touchscreen.touchStart(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async touchMove() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
(0, assert_js_1.assert)('sharedId' in remoteValue);
return this.#frame.page().touchscreen.touchMove(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async touchEnd() {
await this.scrollIntoViewIfNeeded();
await this.#frame.page().touchscreen.touchEnd();
}
async type(text, options) {
await this.focus();
await this.#frame.page().keyboard.type(text, options);
}
async press(key, options) {
await this.focus();
await this.#frame.page().keyboard.press(key, options);
}
}
exports.ElementHandle = ElementHandle;
//# sourceMappingURL=ElementHandle.js.map

@@ -25,3 +25,3 @@ /**

import { Page } from './Page.js';
import { SandboxChart, Sandbox } from './Sandbox.js';
import { Sandbox, SandboxChart } from './Sandbox.js';
/**

@@ -28,0 +28,0 @@ * Puppeteer's Frame class could be viewed as a BiDi BrowsingContext implementation

@@ -412,5 +412,6 @@ "use strict";

async move(x, y, options = {}) {
// https://w3c.github.io/webdriver-bidi/#command-input-performActions:~:text=input.PointerMoveAction%20%3D%20%7B%0A%20%20type%3A%20%22pointerMove%22%2C%0A%20%20x%3A%20js%2Dint%2C
this.#lastMovePoint = {
x,
y,
x: Math.round(x),
y: Math.round(y),
};

@@ -426,4 +427,3 @@ await this.#context.connection.send('input.performActions', {

type: ActionType.PointerMove,
x,
y,
...this.#lastMovePoint,
duration: (options.steps ?? 0) * 50,

@@ -475,4 +475,4 @@ origin: options.origin,

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -564,4 +564,4 @@ },

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -591,4 +591,4 @@ },

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -595,0 +595,0 @@ },

@@ -17,2 +17,3 @@ /**

import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import Protocol from 'devtools-protocol';
import { ElementHandle } from '../../api/ElementHandle.js';

@@ -39,3 +40,4 @@ import { JSHandle as BaseJSHandle } from '../../api/JSHandle.js';

remoteValue(): Bidi.Script.RemoteValue;
remoteObject(): Protocol.Runtime.RemoteObject;
}
//# sourceMappingURL=JSHandle.d.ts.map

@@ -118,4 +118,7 @@ "use strict";

}
remoteObject() {
throw new Error('Not available in WebDriver BiDi');
}
}
exports.JSHandle = JSHandle;
//# sourceMappingURL=JSHandle.js.map

@@ -34,3 +34,3 @@ /**

*/
static _create(product: 'firefox' | 'chrome' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean): Promise<CDPBrowser>;
static _create(product: 'firefox' | 'chrome' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean, useTabTarget?: boolean): Promise<CDPBrowser>;
/**

@@ -43,3 +43,3 @@ * @internal

*/
constructor(product: 'chrome' | 'firefox' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean);
constructor(product: 'chrome' | 'firefox' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean, useTabTarget?: boolean);
/**

@@ -46,0 +46,0 @@ * @internal

@@ -21,2 +21,3 @@ "use strict";

const BrowserContext_js_1 = require("../api/BrowserContext.js");
const environment_js_1 = require("../environment.js");
const assert_js_1 = require("../util/assert.js");

@@ -35,4 +36,4 @@ const ChromeTargetManager_js_1 = require("./ChromeTargetManager.js");

*/
static async _create(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true) {
const browser = new CDPBrowser(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets);
static async _create(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true, useTabTarget = environment_js_1.USE_TAB_TARGET) {
const browser = new CDPBrowser(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets, useTabTarget);
await browser._attach();

@@ -61,3 +62,3 @@ return browser;

*/
constructor(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true) {
constructor(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true, useTabTarget = environment_js_1.USE_TAB_TARGET) {
super();

@@ -81,3 +82,3 @@ product = product || 'chrome';

else {
this.#targetManager = new ChromeTargetManager_js_1.ChromeTargetManager(connection, this.#createTarget, this.#targetFilterCallback, waitForInitiallyDiscoveredTargets);
this.#targetManager = new ChromeTargetManager_js_1.ChromeTargetManager(connection, this.#createTarget, this.#targetFilterCallback, waitForInitiallyDiscoveredTargets, useTabTarget);
}

@@ -279,3 +280,5 @@ this.#defaultContext = new CDPBrowserContext(this.#connection, this);

});
const target = this.#targetManager.getAvailableTargets().get(targetId);
const target = (await this.waitForTarget(t => {
return t._targetId === targetId;
}));
if (!target) {

@@ -282,0 +285,0 @@ throw new Error(`Missing target for page (id = ${targetId})`);

@@ -30,3 +30,3 @@ /**

#private;
constructor(connection: Connection, targetFactory: TargetFactory, targetFilterCallback?: TargetFilterCallback, waitForInitiallyDiscoveredTargets?: boolean);
constructor(connection: Connection, targetFactory: TargetFactory, targetFilterCallback?: TargetFilterCallback, waitForInitiallyDiscoveredTargets?: boolean, useTabTarget?: boolean);
initialize(): Promise<void>;

@@ -33,0 +33,0 @@ dispose(): void;

@@ -19,2 +19,3 @@ "use strict";

exports.ChromeTargetManager = void 0;
const Target_js_1 = require("../api/Target.js");
const assert_js_1 = require("../util/assert.js");

@@ -24,4 +25,10 @@ const Deferred_js_1 = require("../util/Deferred.js");

const EventEmitter_js_1 = require("./EventEmitter.js");
const Target_js_1 = require("./Target.js");
const Target_js_2 = require("./Target.js");
const util_js_1 = require("./util.js");
function isTargetExposed(target) {
return target.type() !== Target_js_1.TargetType.TAB && !target._subtype();
}
function isPageTargetBecomingPrimary(target, newTargetInfo) {
return Boolean(target._subtype()) && !newTargetInfo.subtype;
}
/**

@@ -69,4 +76,11 @@ * ChromeTargetManager uses the CDP's auto-attach mechanism to intercept

#waitForInitiallyDiscoveredTargets = true;
constructor(connection, targetFactory, targetFilterCallback, waitForInitiallyDiscoveredTargets = true) {
// TODO: remove the flag once the testing/rollout is done.
#tabMode;
#discoveryFilter;
constructor(connection, targetFactory, targetFilterCallback, waitForInitiallyDiscoveredTargets = true, useTabTarget = false) {
super();
this.#tabMode = useTabTarget;
this.#discoveryFilter = this.#tabMode
? [{}]
: [{ type: 'tab', exclude: true }, {}];
this.#connection = connection;

@@ -84,3 +98,3 @@ this.#targetFilterCallback = targetFilterCallback;

discover: true,
filter: [{ type: 'tab', exclude: true }, {}],
filter: this.#discoveryFilter,
})

@@ -95,3 +109,3 @@ .then(this.#storeExistingTargetsForInit)

for (const [targetId, targetInfo,] of this.#discoveredTargetsByTargetId.entries()) {
const targetForFilter = new Target_js_1.CDPTarget(targetInfo, undefined, undefined, this, undefined);
const targetForFilter = new Target_js_2.CDPTarget(targetInfo, undefined, undefined, this, undefined);
if ((!this.#targetFilterCallback ||

@@ -109,2 +123,11 @@ this.#targetFilterCallback(targetForFilter)) &&

autoAttach: true,
filter: this.#tabMode
? [
{
type: 'page',
exclude: true,
},
...this.#discoveryFilter,
]
: this.#discoveryFilter,
});

@@ -122,3 +145,9 @@ this.#finishInitializationIfReady();

getAvailableTargets() {
return this.#attachedTargetsByTargetId;
const result = new Map();
for (const [id, target] of this.#attachedTargetsByTargetId.entries()) {
if (isTargetExposed(target)) {
result.set(id, target);
}
}
return result;
}

@@ -204,3 +233,9 @@ addTargetInterceptor(session, interceptor) {

const previousURL = target.url();
const wasInitialized = target._initializedDeferred.value() === Target_js_1.InitializationStatus.SUCCESS;
const wasInitialized = target._initializedDeferred.value() === Target_js_2.InitializationStatus.SUCCESS;
if (isPageTargetBecomingPrimary(target, event.targetInfo)) {
const target = this.#attachedTargetsByTargetId.get(event.targetInfo.targetId);
const session = target?._session();
(0, assert_js_1.assert)(session, 'Target that is being activated is missing a CDPSession.');
session.parentSession()?.emit(Connection_js_1.CDPSessionEmittedEvents.Swapped, session);
}
target._targetInfoChanged(event.targetInfo);

@@ -257,3 +292,3 @@ if (wasInitialized && previousURL !== target.url()) {

? this.#attachedTargetsByTargetId.get(targetInfo.targetId)
: this.#targetFactory(targetInfo, session);
: this.#targetFactory(targetInfo, session, parentSession instanceof Connection_js_1.CDPSession ? parentSession : undefined);
if (this.#targetFilterCallback && !this.#targetFilterCallback(target)) {

@@ -288,3 +323,3 @@ this.#ignoredTargets.add(targetInfo.targetId);

this.#targetsIdsForInit.delete(target._targetId);
if (!existingTarget) {
if (!existingTarget && isTargetExposed(target)) {
this.emit("targetAvailable" /* TargetManagerEmittedEvents.TargetAvailable */, target);

@@ -300,2 +335,3 @@ }

autoAttach: true,
filter: this.#discoveryFilter,
}),

@@ -318,3 +354,5 @@ session.send('Runtime.runIfWaitingForDebugger'),

this.#attachedTargetsByTargetId.delete(target._targetId);
this.emit("targetGone" /* TargetManagerEmittedEvents.TargetGone */, target);
if (isTargetExposed(target)) {
this.emit("targetGone" /* TargetManagerEmittedEvents.TargetGone */, target);
}
};

@@ -321,0 +359,0 @@ }

@@ -22,2 +22,3 @@ /**

import { EventEmitter } from './EventEmitter.js';
import { CDPTarget } from './Target.js';
/**

@@ -132,2 +133,3 @@ * @public

readonly Disconnected: symbol;
readonly Swapped: symbol;
};

@@ -194,2 +196,14 @@ /**

constructor(connection: Connection, targetType: string, sessionId: string, parentSessionId: string | undefined);
/**
* Sets the CDPTarget associated with the session instance.
*
* @internal
*/
_setTarget(target: CDPTarget): void;
/**
* Gets the CDPTarget associated with the session instance.
*
* @internal
*/
_target(): CDPTarget;
connection(): Connection | undefined;

@@ -196,0 +210,0 @@ parentSession(): CDPSession | undefined;

@@ -333,2 +333,3 @@ "use strict";

Disconnected: Symbol('CDPSession.Disconnected'),
Swapped: Symbol('CDPSession.Swapped'),
};

@@ -408,2 +409,3 @@ /**

#parentSessionId;
#target;
/**

@@ -419,2 +421,19 @@ * @internal

}
/**
* Sets the CDPTarget associated with the session instance.
*
* @internal
*/
_setTarget(target) {
this.#target = target;
}
/**
* Gets the CDPTarget associated with the session instance.
*
* @internal
*/
_target() {
(0, assert_js_1.assert)(this.#target, 'Target must exist');
return this.#target;
}
connection() {

@@ -421,0 +440,0 @@ return this.#connection;

@@ -129,2 +129,6 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void;
/**
* @param options - Set of configurable options for coverage defaults to

@@ -174,2 +178,6 @@ * `resetOnNavigation : true, reportAnonymousScripts : false,`

constructor(client: CDPSession);
/**
* @internal
*/
updateClient(client: CDPSession): void;
start(options?: {

@@ -189,2 +197,6 @@ resetOnNavigation?: boolean;

constructor(client: CDPSession);
/**
* @internal
*/
updateClient(client: CDPSession): void;
start(options?: {

@@ -191,0 +203,0 @@ resetOnNavigation?: boolean;

@@ -66,2 +66,9 @@ "use strict";

/**
* @internal
*/
updateClient(client) {
this.#jsCoverage.updateClient(client);
this.#cssCoverage.updateClient(client);
}
/**
* @param options - Set of configurable options for coverage defaults to

@@ -129,2 +136,8 @@ * `resetOnNavigation : true, reportAnonymousScripts : false,`

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async start(options = {}) {

@@ -231,2 +244,8 @@ (0, assert_js_1.assert)(!this.#enabled, 'JSCoverage is already enabled');

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async start(options = {}) {

@@ -233,0 +252,0 @@ (0, assert_js_1.assert)(!this.#enabled, 'CSSCoverage is already enabled');

@@ -18,4 +18,3 @@ /**

import { Protocol } from 'devtools-protocol';
import { AutofillData, BoundingBox, BoxModel, ClickOptions, ElementHandle, Offset, Point } from '../api/ElementHandle.js';
import { KeyPressOptions, KeyboardTypeOptions } from '../api/Input.js';
import { AutofillData, ElementHandle, Point } from '../api/ElementHandle.js';
import { ScreenshotOptions } from '../api/Page.js';

@@ -28,3 +27,2 @@ import { CDPSession } from './Connection.js';

import { NodeFor } from './types.js';
import { KeyInput } from './USKeyboardLayout.js';
/**

@@ -54,18 +52,5 @@ * The CDPElementHandle extends ElementHandle now to keep compatibility

waitForSelector<Selector extends string>(selector: Selector, options?: WaitForSelectorOptions): Promise<CDPElementHandle<NodeFor<Selector>> | null>;
contentFrame(): Promise<Frame | null>;
contentFrame(this: ElementHandle<HTMLIFrameElement>): Promise<Frame>;
scrollIntoView(this: CDPElementHandle<Element>): Promise<void>;
clickablePoint(offset?: Offset): Promise<Point>;
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to hover over the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
hover(this: CDPElementHandle<Element>): Promise<void>;
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to click in the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
click(this: CDPElementHandle<Element>, options?: Readonly<ClickOptions>): Promise<void>;
/**
* This method creates and captures a dragevent from the element.

@@ -81,13 +66,6 @@ */

uploadFile(this: CDPElementHandle<HTMLInputElement>, ...filePaths: string[]): Promise<void>;
tap(this: CDPElementHandle<Element>): Promise<void>;
touchStart(this: CDPElementHandle<Element>): Promise<void>;
touchMove(this: CDPElementHandle<Element>): Promise<void>;
touchEnd(this: CDPElementHandle<Element>): Promise<void>;
type(text: string, options?: Readonly<KeyboardTypeOptions>): Promise<void>;
press(key: KeyInput, options?: Readonly<KeyPressOptions>): Promise<void>;
boundingBox(): Promise<BoundingBox | null>;
boxModel(): Promise<BoxModel | null>;
screenshot(this: CDPElementHandle<Element>, options?: ScreenshotOptions): Promise<string | Buffer>;
autofill(data: AutofillData): Promise<void>;
assertElementHasWorld(): asserts this;
}
//# sourceMappingURL=ElementHandle.d.ts.map

@@ -46,7 +46,2 @@ "use strict";

const util_js_1 = require("./util.js");
const applyOffsetsToQuad = (quad, offsetX, offsetY) => {
return quad.map(part => {
return { x: part.x + offsetX, y: part.y + offsetY };
});
};
/**

@@ -120,139 +115,3 @@ * The CDPElementHandle extends ElementHandle now to keep compatibility

}
async #getOOPIFOffsets(frame) {
let offsetX = 0;
let offsetY = 0;
let currentFrame = frame;
while (currentFrame && currentFrame.parentFrame()) {
const parent = currentFrame.parentFrame();
if (!currentFrame.isOOPFrame() || !parent) {
currentFrame = parent;
continue;
}
const { backendNodeId } = await parent._client().send('DOM.getFrameOwner', {
frameId: currentFrame._id,
});
const result = await parent._client().send('DOM.getBoxModel', {
backendNodeId: backendNodeId,
});
if (!result) {
break;
}
const contentBoxQuad = result.model.content;
const topLeftCorner = this.#fromProtocolQuad(contentBoxQuad)[0];
offsetX += topLeftCorner.x;
offsetY += topLeftCorner.y;
currentFrame = parent;
}
return { offsetX, offsetY };
}
async clickablePoint(offset) {
const [result, layoutMetrics] = await Promise.all([
this.client
.send('DOM.getContentQuads', {
objectId: this.id,
})
.catch(util_js_1.debugError),
this.#page._client().send('Page.getLayoutMetrics'),
]);
if (!result || !result.quads.length) {
throw new Error('Node is either not clickable or not an HTMLElement');
}
// Filter out quads that have too small area to click into.
// Fallback to `layoutViewport` in case of using Firefox.
const { clientWidth, clientHeight } = layoutMetrics.cssLayoutViewport || layoutMetrics.layoutViewport;
const { offsetX, offsetY } = await this.#getOOPIFOffsets(this.#frame);
const quads = result.quads
.map(quad => {
return this.#fromProtocolQuad(quad);
})
.map(quad => {
return applyOffsetsToQuad(quad, offsetX, offsetY);
})
.map(quad => {
return this.#intersectQuadWithViewport(quad, clientWidth, clientHeight);
})
.filter(quad => {
return computeQuadArea(quad) > 1;
});
if (!quads.length) {
throw new Error('Node is either not clickable or not an HTMLElement');
}
const quad = quads[0];
if (offset) {
// Return the point of the first quad identified by offset.
let minX = Number.MAX_SAFE_INTEGER;
let minY = Number.MAX_SAFE_INTEGER;
for (const point of quad) {
if (point.x < minX) {
minX = point.x;
}
if (point.y < minY) {
minY = point.y;
}
}
if (minX !== Number.MAX_SAFE_INTEGER &&
minY !== Number.MAX_SAFE_INTEGER) {
return {
x: minX + offset.x,
y: minY + offset.y,
};
}
}
// Return the middle point of the first quad.
let x = 0;
let y = 0;
for (const point of quad) {
x += point.x;
y += point.y;
}
return {
x: x / 4,
y: y / 4,
};
}
#getBoxModel() {
const params = {
objectId: this.id,
};
return this.client.send('DOM.getBoxModel', params).catch(error => {
return (0, util_js_1.debugError)(error);
});
}
#fromProtocolQuad(quad) {
return [
{ x: quad[0], y: quad[1] },
{ x: quad[2], y: quad[3] },
{ x: quad[4], y: quad[5] },
{ x: quad[6], y: quad[7] },
];
}
#intersectQuadWithViewport(quad, width, height) {
return quad.map(point => {
return {
x: Math.min(Math.max(point.x, 0), width),
y: Math.min(Math.max(point.y, 0), height),
};
});
}
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to hover over the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
async hover() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.mouse.move(x, y);
}
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to click in the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
async click(options = {}) {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint(options.offset);
await this.#page.mouse.click(x, y, options);
}
/**
* This method creates and captures a dragevent from the element.

@@ -336,59 +195,2 @@ */

}
async tap() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.touchscreen.touchStart(x, y);
await this.#page.touchscreen.touchEnd();
}
async touchStart() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.touchscreen.touchStart(x, y);
}
async touchMove() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.touchscreen.touchMove(x, y);
}
async touchEnd() {
await this.scrollIntoViewIfNeeded();
await this.#page.touchscreen.touchEnd();
}
async type(text, options) {
await this.focus();
await this.#page.keyboard.type(text, options);
}
async press(key, options) {
await this.focus();
await this.#page.keyboard.press(key, options);
}
async boundingBox() {
const result = await this.#getBoxModel();
if (!result) {
return null;
}
const { offsetX, offsetY } = await this.#getOOPIFOffsets(this.#frame);
const quad = result.model.border;
const x = Math.min(quad[0], quad[2], quad[4], quad[6]);
const y = Math.min(quad[1], quad[3], quad[5], quad[7]);
const width = Math.max(quad[0], quad[2], quad[4], quad[6]) - x;
const height = Math.max(quad[1], quad[3], quad[5], quad[7]) - y;
return { x: x + offsetX, y: y + offsetY, width, height };
}
async boxModel() {
const result = await this.#getBoxModel();
if (!result) {
return null;
}
const { offsetX, offsetY } = await this.#getOOPIFOffsets(this.#frame);
const { content, padding, border, margin, width, height } = result.model;
return {
content: applyOffsetsToQuad(this.#fromProtocolQuad(content), offsetX, offsetY),
padding: applyOffsetsToQuad(this.#fromProtocolQuad(padding), offsetX, offsetY),
border: applyOffsetsToQuad(this.#fromProtocolQuad(border), offsetX, offsetY),
margin: applyOffsetsToQuad(this.#fromProtocolQuad(margin), offsetX, offsetY),
width,
height,
};
}
async screenshot(options = {}) {

@@ -440,16 +242,7 @@ let needsViewportReset = false;

}
assertElementHasWorld() {
(0, assert_js_1.assert)(this.executionContext()._world);
}
}
exports.CDPElementHandle = CDPElementHandle;
function computeQuadArea(quad) {
/* Compute sum of all directed areas of adjacent triangles
https://en.wikipedia.org/wiki/Polygon#Simple_polygons
*/
let area = 0;
for (let i = 0; i < quad.length; ++i) {
const p1 = quad[i];
const p2 = quad[(i + 1) % quad.length];
area += (p1.x * p2.y - p2.x * p1.y) / 2;
}
return Math.abs(area);
}
//# sourceMappingURL=ElementHandle.js.map

@@ -26,2 +26,3 @@ /**

constructor(client: CDPSession);
updateClient(client: CDPSession): void;
get javascriptEnabled(): boolean;

@@ -28,0 +29,0 @@ emulateViewport(viewport: Viewport): Promise<boolean>;

@@ -17,2 +17,5 @@ "use strict";

}
updateClient(client) {
this.#client = client;
}
get javascriptEnabled() {

@@ -19,0 +22,0 @@ return this.#javascriptEnabled;

@@ -76,3 +76,5 @@ "use strict";

const results = AriaQueryHandler_js_1.ARIAQueryHandler.queryAll(element, selector);
return element.executionContext().evaluateHandle((...elements) => {
return element
.executionContext()
.evaluateHandle((...elements) => {
return elements;

@@ -79,0 +81,0 @@ }, ...(await AsyncIterableUtil_js_1.AsyncIterableUtil.collect(results)));

@@ -40,2 +40,3 @@ /**

FrameDetached: symbol;
FrameSwappedByActivation: symbol;
};

@@ -54,3 +55,8 @@ /**

constructor(frameManager: FrameManager, frameId: string, parentFrameId: string | undefined, client: CDPSession);
updateClient(client: CDPSession): void;
/**
* Updates the frame ID with the new ID. This happens when the main frame is
* replaced by a different frame.
*/
updateId(id: string): void;
updateClient(client: CDPSession, keepWorlds?: boolean): void;
page(): Page;

@@ -57,0 +63,0 @@ isOOPFrame(): boolean;

@@ -39,2 +39,3 @@ "use strict";

FrameDetached: Symbol('Frame.FrameDetached'),
FrameSwappedByActivation: Symbol('Frame.FrameSwappedByActivation'),
};

@@ -63,9 +64,27 @@ /**

this.updateClient(client);
this.on(exports.FrameEmittedEvents.FrameSwappedByActivation, () => {
// Emulate loading process for swapped frames.
this._onLoadingStarted();
this._onLoadingStopped();
});
}
updateClient(client) {
/**
* Updates the frame ID with the new ID. This happens when the main frame is
* replaced by a different frame.
*/
updateId(id) {
this._id = id;
}
updateClient(client, keepWorlds = false) {
this.#client = client;
this.worlds = {
[IsolatedWorlds_js_1.MAIN_WORLD]: new IsolatedWorld_js_1.IsolatedWorld(this),
[IsolatedWorlds_js_1.PUPPETEER_WORLD]: new IsolatedWorld_js_1.IsolatedWorld(this),
};
if (!keepWorlds) {
this.worlds = {
[IsolatedWorlds_js_1.MAIN_WORLD]: new IsolatedWorld_js_1.IsolatedWorld(this),
[IsolatedWorlds_js_1.PUPPETEER_WORLD]: new IsolatedWorld_js_1.IsolatedWorld(this),
};
}
else {
this.worlds[IsolatedWorlds_js_1.MAIN_WORLD].frameUpdated();
this.worlds[IsolatedWorlds_js_1.PUPPETEER_WORLD].frameUpdated();
}
}

@@ -72,0 +91,0 @@ page() {

@@ -59,2 +59,8 @@ /**

constructor(client: CDPSession, page: Page, ignoreHTTPSErrors: boolean, timeoutSettings: TimeoutSettings);
/**
* When the main frame is replaced by another main frame,
* we maintain the main frame object identity while updating
* its frame tree and ID.
*/
swapFrameTree(client: CDPSession): Promise<void>;
private setupEventListeners;

@@ -61,0 +67,0 @@ initialize(client?: CDPSession): Promise<void>;

@@ -20,2 +20,3 @@ "use strict";

const assert_js_1 = require("../util/assert.js");
const Deferred_js_1 = require("../util/Deferred.js");
const ErrorLike_js_1 = require("../util/ErrorLike.js");

@@ -49,2 +50,3 @@ const Connection_js_1 = require("./Connection.js");

};
const TIME_FOR_WAITING_FOR_SWAP = 100; // ms.
/**

@@ -90,8 +92,61 @@ * A frame manager manages the frames for a given {@link Page | page}.

client.once(Connection_js_1.CDPSessionEmittedEvents.Disconnected, () => {
const mainFrame = this._frameTree.getMainFrame();
if (mainFrame) {
this.#removeFramesRecursively(mainFrame);
}
this.#onClientDisconnect().catch(util_js_1.debugError);
});
}
/**
* Called when the frame's client is disconnected. We don't know if the
* disconnect means that the frame is removed or if it will be replaced by a
* new frame. Therefore, we wait for a swap event.
*/
async #onClientDisconnect() {
const mainFrame = this._frameTree.getMainFrame();
if (!mainFrame) {
return;
}
for (const child of mainFrame.childFrames()) {
this.#removeFramesRecursively(child);
}
const swapped = Deferred_js_1.Deferred.create({
timeout: TIME_FOR_WAITING_FOR_SWAP,
message: 'Frame was not swapped',
});
mainFrame.once(Frame_js_1.FrameEmittedEvents.FrameSwappedByActivation, () => {
swapped.resolve();
});
try {
await swapped.valueOrThrow();
}
catch (err) {
this.#removeFramesRecursively(mainFrame);
}
}
/**
* When the main frame is replaced by another main frame,
* we maintain the main frame object identity while updating
* its frame tree and ID.
*/
async swapFrameTree(client) {
this.#onExecutionContextsCleared(this.#client);
this.#client = client;
(0, assert_js_1.assert)(this.#client instanceof Connection_js_1.CDPSessionImpl, 'CDPSession is not an instance of CDPSessionImpl.');
const frame = this._frameTree.getMainFrame();
if (frame) {
this.#frameNavigatedReceived.add(this.#client._target()._targetId);
this._frameTree.removeFrame(frame);
frame.updateId(this.#client._target()._targetId);
frame.mainRealm().clearContext();
frame.isolatedRealm().clearContext();
this._frameTree.addFrame(frame);
frame.updateClient(client, true);
}
this.setupEventListeners(client);
client.once(Connection_js_1.CDPSessionEmittedEvents.Disconnected, () => {
this.#onClientDisconnect().catch(util_js_1.debugError);
});
await this.initialize(client);
await this.#networkManager.updateClient(client);
if (frame) {
frame.emit(Frame_js_1.FrameEmittedEvents.FrameSwappedByActivation);
}
}
setupEventListeners(session) {

@@ -98,0 +153,0 @@ session.on('Page.frameAttached', event => {

@@ -34,2 +34,6 @@ /**

constructor(client: CDPSession);
/**
* @internal
*/
updateClient(client: CDPSession): void;
down(key: KeyInput, options?: Readonly<KeyDownOptions>): Promise<void>;

@@ -51,2 +55,6 @@ up(key: KeyInput): Promise<void>;

constructor(client: CDPSession, keyboard: CDPKeyboard);
/**
* @internal
*/
updateClient(client: CDPSession): void;
reset(): Promise<void>;

@@ -75,2 +83,6 @@ move(x: number, y: number, options?: Readonly<MouseMoveOptions>): Promise<void>;

constructor(client: CDPSession, keyboard: CDPKeyboard);
/**
* @internal
*/
updateClient(client: CDPSession): void;
tap(x: number, y: number): Promise<void>;

@@ -77,0 +89,0 @@ touchStart(x: number, y: number): Promise<void>;

@@ -39,2 +39,8 @@ "use strict";

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async down(key, options = {

@@ -219,2 +225,8 @@ text: undefined,

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
#_state = {

@@ -452,2 +464,8 @@ position: { x: 0, y: 0 },

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async tap(x, y) {

@@ -454,0 +472,0 @@ await this.touchStart(x, y);

@@ -82,2 +82,3 @@ /**

constructor(frame: Frame);
frameUpdated(): void;
frame(): Frame;

@@ -84,0 +85,0 @@ clearContext(): void;

@@ -45,5 +45,6 @@ "use strict";

constructor(frame) {
// Keep own reference to client because it might differ from the FrameManager's
// client for OOP iframes.
this.#frame = frame;
this.frameUpdated();
}
frameUpdated() {
this.#client.on('Runtime.bindingCalled', this.#onBindingCalled);

@@ -282,3 +283,10 @@ }

const context = await this.executionContext();
(0, assert_js_1.assert)(handle.executionContext() !== context, 'Cannot adopt handle that already belongs to this execution context');
if (handle.executionContext() === context) {
// If the context has already adopted this handle, clone it so downstream
// disposal doesn't become an issue.
return (await handle.evaluateHandle(value => {
return value;
// SAFETY: We know the
}));
}
const nodeInfo = await this.#client.send('DOM.describeNode', {

@@ -285,0 +293,0 @@ objectId: handle.id,

@@ -67,2 +67,3 @@ "use strict";

(0, util_js_1.addEventListener)(frame, Frame_js_1.FrameEmittedEvents.FrameSwapped, this.#frameSwapped.bind(this)),
(0, util_js_1.addEventListener)(frame, Frame_js_1.FrameEmittedEvents.FrameSwappedByActivation, this.#frameSwapped.bind(this)),
(0, util_js_1.addEventListener)(frame, Frame_js_1.FrameEmittedEvents.FrameDetached, this.#onFrameDetached.bind(this)),

@@ -69,0 +70,0 @@ (0, util_js_1.addEventListener)(networkManager, NetworkManager_js_1.NetworkManagerEmittedEvents.Request, this.#onRequest.bind(this)),

@@ -60,2 +60,3 @@ /**

constructor(client: CDPSession, ignoreHTTPSErrors: boolean, frameManager: Pick<FrameManager, 'frame'>);
updateClient(client: CDPSession): Promise<void>;
/**

@@ -62,0 +63,0 @@ * Initialize calls should avoid async dependencies between CDP calls as those

@@ -60,2 +60,18 @@ "use strict";

#deferredInit;
#handlers = new Map([
['Fetch.requestPaused', this.#onRequestPaused.bind(this)],
['Fetch.authRequired', this.#onAuthRequired.bind(this)],
['Network.requestWillBeSent', this.#onRequestWillBeSent.bind(this)],
[
'Network.requestServedFromCache',
this.#onRequestServedFromCache.bind(this),
],
['Network.responseReceived', this.#onResponseReceived.bind(this)],
['Network.loadingFinished', this.#onLoadingFinished.bind(this)],
['Network.loadingFailed', this.#onLoadingFailed.bind(this)],
[
'Network.responseReceivedExtraInfo',
this.#onResponseReceivedExtraInfo.bind(this),
],
]);
constructor(client, ignoreHTTPSErrors, frameManager) {

@@ -66,11 +82,14 @@ super();

this.#frameManager = frameManager;
this.#client.on('Fetch.requestPaused', this.#onRequestPaused.bind(this));
this.#client.on('Fetch.authRequired', this.#onAuthRequired.bind(this));
this.#client.on('Network.requestWillBeSent', this.#onRequestWillBeSent.bind(this));
this.#client.on('Network.requestServedFromCache', this.#onRequestServedFromCache.bind(this));
this.#client.on('Network.responseReceived', this.#onResponseReceived.bind(this));
this.#client.on('Network.loadingFinished', this.#onLoadingFinished.bind(this));
this.#client.on('Network.loadingFailed', this.#onLoadingFailed.bind(this));
this.#client.on('Network.responseReceivedExtraInfo', this.#onResponseReceivedExtraInfo.bind(this));
for (const [event, handler] of this.#handlers) {
this.#client.on(event, handler);
}
}
async updateClient(client) {
this.#client = client;
for (const [event, handler] of this.#handlers) {
this.#client.on(event, handler);
}
this.#deferredInit = undefined;
await this.initialize();
}
/**

@@ -77,0 +96,0 @@ * Initialize calls should avoid async dependencies between CDP calls as those

@@ -114,5 +114,2 @@ /**

}): Promise<void>;
waitForFrame(urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>), options?: {
timeout?: number;
}): Promise<Frame>;
goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;

@@ -119,0 +116,0 @@ goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;

@@ -67,2 +67,3 @@ "use strict";

#client;
#tabSession;
#target;

@@ -219,2 +220,3 @@ #keyboard;

this.#client = client;
this.#tabSession = client.parentSession();
this.#target = target;

@@ -232,2 +234,17 @@ this.#keyboard = new Input_js_1.CDPKeyboard(client);

this.#setupEventListeners();
this.#tabSession?.on(Connection_js_1.CDPSessionEmittedEvents.Swapped, async (newSession) => {
this.#client = newSession;
(0, assert_js_1.assert)(this.#client instanceof Connection_js_1.CDPSessionImpl, 'CDPSession is not instance of CDPSessionImpl');
this.#target = this.#client._target();
(0, assert_js_1.assert)(this.#target, 'Missing target on swap');
this.#keyboard.updateClient(newSession);
this.#mouse.updateClient(newSession);
this.#touchscreen.updateClient(newSession);
this.#accessibility.updateClient(newSession);
this.#emulationManager.updateClient(newSession);
this.#tracing.updateClient(newSession);
this.#coverage.updateClient(newSession);
await this.#frameManager.swapFrameTree(newSession);
this.#setupEventListeners();
});
}

@@ -694,31 +711,2 @@ #setupEventListeners() {

}
async waitForFrame(urlOrPredicate, options = {}) {
const { timeout = this.#timeoutSettings.timeout() } = options;
let predicate;
if ((0, util_js_1.isString)(urlOrPredicate)) {
predicate = (frame) => {
return Promise.resolve(urlOrPredicate === frame.url());
};
}
else {
predicate = (frame) => {
const value = urlOrPredicate(frame);
if (typeof value === 'boolean') {
return Promise.resolve(value);
}
return value;
};
}
const eventRace = Deferred_js_1.Deferred.race([
(0, util_js_1.waitForEvent)(this.#frameManager, FrameManager_js_1.FrameManagerEmittedEvents.FrameAttached, predicate, timeout, this.#sessionCloseDeferred.valueOrThrow()),
(0, util_js_1.waitForEvent)(this.#frameManager, FrameManager_js_1.FrameManagerEmittedEvents.FrameNavigated, predicate, timeout, this.#sessionCloseDeferred.valueOrThrow()),
...this.frames().map(async (frame) => {
if (await predicate(frame)) {
return frame;
}
return await eventRace;
}),
]);
return eventRace;
}
async goBack(options = {}) {

@@ -725,0 +713,0 @@ return this.#go(-1, options);

@@ -60,2 +60,6 @@ /**

*/
_subtype(): string | undefined;
/**
* @internal
*/
_session(): CDPSession | undefined;

@@ -62,0 +66,0 @@ /**

@@ -21,2 +21,3 @@ "use strict";

const Deferred_js_1 = require("../util/Deferred.js");
const Connection_js_1 = require("./Connection.js");
const Page_js_1 = require("./Page.js");

@@ -67,2 +68,5 @@ const util_js_1 = require("./util.js");

this.#sessionFactory = sessionFactory;
if (this.#session && this.#session instanceof Connection_js_1.CDPSessionImpl) {
this.#session._setTarget(this);
}
}

@@ -72,2 +76,8 @@ /**

*/
_subtype() {
return this.#targetInfo.subtype;
}
/**
* @internal
*/
_session() {

@@ -89,3 +99,6 @@ return this.#session;

}
return this.#sessionFactory(false);
return this.#sessionFactory(false).then(session => {
session._setTarget(this);
return session;
});
}

@@ -110,2 +123,4 @@ url() {

return Target_js_1.TargetType.WEBVIEW;
case 'tab':
return Target_js_1.TargetType.TAB;
default:

@@ -112,0 +127,0 @@ return Target_js_1.TargetType.OTHER;

@@ -23,3 +23,3 @@ /**

*/
export type TargetFactory = (targetInfo: Protocol.Target.TargetInfo, session?: CDPSession) => CDPTarget;
export type TargetFactory = (targetInfo: Protocol.Target.TargetInfo, session?: CDPSession, parentSession?: CDPSession) => CDPTarget;
/**

@@ -26,0 +26,0 @@ * @internal

@@ -34,2 +34,6 @@ /// <reference types="node" />

/**
* @internal
*/
updateClient(client: CDPSession): void;
/**
* Starts a trace for the current page.

@@ -36,0 +40,0 @@ * @remarks

@@ -50,2 +50,8 @@ "use strict";

/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
/**
* Starts a trace for the current page.

@@ -52,0 +58,0 @@ * @remarks

@@ -28,2 +28,3 @@ /**

import type { ExecutionContext } from './ExecutionContext.js';
import { Awaitable } from './types.js';
/**

@@ -113,3 +114,3 @@ * @internal

*/
export declare function waitForEvent<T>(emitter: CommonEventEmitter, eventName: string | symbol, predicate: (event: T) => Promise<boolean> | boolean, timeout: number, abortPromise: Promise<Error> | Deferred<Error>): Promise<T>;
export declare function waitForEvent<T>(emitter: CommonEventEmitter, eventName: string | symbol, predicate: (event: T) => Awaitable<boolean>, timeout: number, abortPromise: Promise<Error> | Deferred<Error>): Promise<T>;
/**

@@ -116,0 +117,0 @@ * @internal

@@ -24,2 +24,8 @@ /**

export declare const DEFERRED_PROMISE_DEBUG_TIMEOUT: number;
/**
* Only used for internal testing.
*
* @internal
*/
export declare const USE_TAB_TARGET: boolean;
//# sourceMappingURL=environment.d.ts.map

@@ -18,3 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFERRED_PROMISE_DEBUG_TIMEOUT = exports.isNode = void 0;
exports.USE_TAB_TARGET = exports.DEFERRED_PROMISE_DEBUG_TIMEOUT = exports.isNode = void 0;
/**

@@ -31,2 +31,10 @@ * @internal

: -1;
/**
* Only used for internal testing.
*
* @internal
*/
exports.USE_TAB_TARGET = typeof process !== 'undefined'
? process.env['PUPPETEER_INTERNAL_TAB_TARGET'] === 'true'
: false;
//# sourceMappingURL=environment.js.map

@@ -8,3 +8,3 @@ /**

*/
export declare const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6+)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6+)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6+)\",\"(?<argument>.+)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
export declare const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6*)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6*)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6*)\",\"(?<argument>.*)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
//# sourceMappingURL=injected.d.ts.map

@@ -11,3 +11,3 @@ "use strict";

*/
exports.source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶+)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶+)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6+)\",\"(?<argument>.+)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
exports.source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶*)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶*)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6*)\",\"(?<argument>.*)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
//# sourceMappingURL=injected.js.map
/**
* @internal
*/
export declare const packageVersion = "21.1.0";
export declare const packageVersion = "21.1.1";
//# sourceMappingURL=version.d.ts.map

@@ -7,3 +7,3 @@ "use strict";

*/
exports.packageVersion = '21.1.0';
exports.packageVersion = '21.1.1';
//# sourceMappingURL=version.js.map

@@ -40,3 +40,3 @@ /**

customQuerySelectors: {
"__#46411@#selectors": Map<string, CustomQuerySelectors.CustomQuerySelector>;
"__#47412@#selectors": Map<string, CustomQuerySelectors.CustomQuerySelector>;
register(name: string, handler: import("../puppeteer-core.js").CustomQueryHandler): void;

@@ -43,0 +43,0 @@ unregister(name: string): void;

@@ -26,2 +26,3 @@ "use strict";

const util_js_1 = require("../common/util.js");
const environment_js_1 = require("../environment.js");
const assert_js_1 = require("../util/assert.js");

@@ -137,2 +138,3 @@ const ProductLauncher_js_1 = require("./ProductLauncher.js");

'--disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints',
...(environment_js_1.USE_TAB_TARGET ? [] : ['--disable-features=Prerender2']),
'--disable-hang-monitor',

@@ -139,0 +141,0 @@ '--disable-ipc-flooding-protection',

@@ -17,1 +17,2 @@ /**

export { catchError, defaultIfEmpty, filter, first, ignoreElements, map, mergeMap, raceWith, retry, tap, throwIfEmpty, firstValueFrom, defer, EMPTY, from, fromEvent, merge, race, timer, OperatorFunction, identity, noop, pipe, Observable, } from 'rxjs';
export declare function filterAsync<T>(predicate: (value: T) => boolean | PromiseLike<boolean>): import("rxjs").OperatorFunction<T, T>;

@@ -1,1 +0,1 @@

"use strict";var n=function(t,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])},n(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(n,t,r,e){return new(r||(r=Promise))((function(o,i){function u(n){try{s(e.next(n))}catch(n){i(n)}}function c(n){try{s(e.throw(n))}catch(n){i(n)}}function s(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(u,c)}s((e=e.apply(n,t||[])).next())}))}function e(n,t){var r,e,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,e=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(n,u)}catch(n){c=[6,n],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(n){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&n[t],e=0;if(r)return r.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&e>=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var e,o,i=r.call(n),u=[];try{for(;(void 0===t||t-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(n){o={error:n}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(n,t,r){if(r||2===arguments.length)for(var e,o=0,i=t.length;o<i;o++)!e&&o in t||(e||(e=Array.prototype.slice.call(t,0,o)),e[o]=t[o]);return n.concat(e||Array.prototype.slice.call(t))}function c(n){return this instanceof c?(this.v=n,this):new c(n)}function s(n,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(n,t||[]),i=[];return e={},u("next"),u("throw"),u("return"),e[Symbol.asyncIterator]=function(){return this},e;function u(n){o[n]&&(e[n]=function(t){return new Promise((function(r,e){i.push([n,t,r,e])>1||s(n,t)}))})}function s(n,t){try{(r=o[n](t)).value instanceof c?Promise.resolve(r.value.v).then(a,l):f(i[0][2],r)}catch(n){f(i[0][3],n)}var r}function a(n){s("next",n)}function l(n){s("throw",n)}function f(n,t){n(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function a(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=n[Symbol.asyncIterator];return r?r.call(n):(n=o(n),t={},e("next"),e("throw"),e("return"),t[Symbol.asyncIterator]=function(){return this},t);function e(r){t[r]=n[r]&&function(t){return new Promise((function(e,o){(function(n,t,r,e){Promise.resolve(e).then((function(t){n({value:t,done:r})}),t)})(e,o,(t=n[r](t)).done,t.value)}))}}}function l(n){return"function"==typeof n}function f(n){var t=n((function(n){Error.call(n),n.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var p=f((function(n){return function(t){n(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(n,t){return t+1+") "+n.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function h(n,t){if(n){var r=n.indexOf(t);0<=r&&n.splice(r,1)}}var v=function(){function n(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return n.prototype.unsubscribe=function(){var n,t,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=o(s),f=a.next();!f.done;f=a.next()){f.value.remove(this)}}catch(t){n={error:t}}finally{try{f&&!f.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}else s.remove(this);var h=this.initialTeardown;if(l(h))try{h()}catch(n){c=n instanceof p?n.errors:[n]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var d=o(v),y=d.next();!y.done;y=d.next()){var m=y.value;try{b(m)}catch(n){c=null!=c?c:[],n instanceof p?c=u(u([],i(c)),i(n.errors)):c.push(n)}}}catch(n){r={error:n}}finally{try{y&&!y.done&&(e=d.return)&&e.call(d)}finally{if(r)throw r.error}}}if(c)throw new p(c)}},n.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)b(t);else{if(t instanceof n){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},n.prototype._hasParent=function(n){var t=this._parentage;return t===n||Array.isArray(t)&&t.includes(n)},n.prototype._addParent=function(n){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(n),t):t?[t,n]:n},n.prototype._removeParent=function(n){var t=this._parentage;t===n?this._parentage=null:Array.isArray(t)&&h(t,n)},n.prototype.remove=function(t){var r=this._finalizers;r&&h(r,t),t instanceof n&&t._removeParent(this)},n.EMPTY=((t=new n).closed=!0,t),n}();function d(n){return n instanceof v||n&&"closed"in n&&l(n.remove)&&l(n.add)&&l(n.unsubscribe)}function b(n){l(n)?n():n.unsubscribe()}v.EMPTY;var y={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},m={setTimeout:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=m.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,u([n,t],i(r))):setTimeout.apply(void 0,u([n,t],i(r)))},clearTimeout:function(n){var t=m.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(n)},delegate:void 0};function w(n){m.setTimeout((function(){throw n}))}function x(){}var g=function(n){function r(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,d(t)&&t.add(r)):r.destination=P,r}return t(r,n),r.create=function(n,t,r){return new I(n,t,r)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(v),_=Function.prototype.bind;function S(n,t){return _.call(n,t)}var E=function(){function n(n){this.partialObserver=n}return n.prototype.next=function(n){var t=this.partialObserver;if(t.next)try{t.next(n)}catch(n){A(n)}},n.prototype.error=function(n){var t=this.partialObserver;if(t.error)try{t.error(n)}catch(n){A(n)}else A(n)},n.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){A(n)}},n}(),I=function(n){function r(t,r,e){var o,i,u=n.call(this)||this;l(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:u&&y.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},o={next:t.next&&S(t.next,i),error:t.error&&S(t.error,i),complete:t.complete&&S(t.complete,i)}):o=t;return u.destination=new E(o),u}return t(r,n),r}(g);function A(n){w(n)}var P={closed:!0,next:x,error:function(n){throw n},complete:x},T="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(n){return n}function j(n){return 0===n.length?O:1===n.length?n[0]:function(t){return n.reduce((function(n,t){return t(n)}),t)}}var k=function(){function n(n){n&&(this._subscribe=n)}return n.prototype.lift=function(t){var r=new n;return r.source=this,r.operator=t,r},n.prototype.subscribe=function(n,t,r){var e,o=this,i=(e=n)&&e instanceof g||function(n){return n&&l(n.next)&&l(n.error)&&l(n.complete)}(e)&&d(e)?n:new I(n,t,r);return function(){var n=o,t=n.operator,r=n.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},n.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(t){n.error(t)}},n.prototype.forEach=function(n,t){var r=this;return new(t=z(t))((function(t,e){var o=new I({next:function(t){try{n(t)}catch(n){e(n),o.unsubscribe()}},error:e,complete:t});r.subscribe(o)}))},n.prototype._subscribe=function(n){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(n)},n.prototype[T]=function(){return this},n.prototype.pipe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return j(n)(this)},n.prototype.toPromise=function(n){var t=this;return new(n=z(n))((function(n,r){var e;t.subscribe((function(n){return e=n}),(function(n){return r(n)}),(function(){return n(e)}))}))},n.create=function(t){return new n(t)},n}();function z(n){var t;return null!==(t=null!=n?n:y.Promise)&&void 0!==t?t:Promise}function L(n){return function(t){if(function(n){return l(null==n?void 0:n.lift)}(t))return t.lift((function(t){try{return n(t,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}function U(n,t,r,e,o){return new C(n,t,r,e,o)}var C=function(n){function r(t,r,e,o,i,u){var c=n.call(this,t)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(n){try{r(n)}catch(n){t.error(n)}}:n.prototype._next,c._error=o?function(n){try{o(n)}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._error,c._complete=e?function(){try{e()}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._complete,c}return t(r,n),r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;n.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},r}(g),D={now:function(){return(D.delegate||Date).now()},delegate:void 0},N=function(n){function r(t,r){return n.call(this)||this}return t(r,n),r.prototype.schedule=function(n,t){return this},r}(v),Y={setInterval:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=Y.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,u([n,t],i(r))):setInterval.apply(void 0,u([n,t],i(r)))},clearInterval:function(n){var t=Y.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(n)},delegate:void 0},F=function(n){function r(t,r){var e=n.call(this,t,r)||this;return e.scheduler=t,e.work=r,e.pending=!1,e}return t(r,n),r.prototype.schedule=function(n,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=n;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},r.prototype.requestAsyncId=function(n,t,r){return void 0===r&&(r=0),Y.setInterval(n.flush.bind(n,this),r)},r.prototype.recycleAsyncId=function(n,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&Y.clearInterval(t)},r.prototype.execute=function(n,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(n,t){var r,e=!1;try{this.work(n)}catch(n){e=!0,r=n||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,h(e,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,n.prototype.unsubscribe.call(this)}},r}(N),M=function(){function n(t,r){void 0===r&&(r=n.now),this.schedulerActionCtor=t,this.now=r}return n.prototype.schedule=function(n,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,n).schedule(r,t)},n.now=D.now,n}(),q=new(function(n){function r(t,r){void 0===r&&(r=M.now);var e=n.call(this,t,r)||this;return e.actions=[],e._active=!1,e}return t(r,n),r.prototype.flush=function(n){var t=this.actions;if(this._active)t.push(n);else{var r;this._active=!0;do{if(r=n.execute(n.state,n.delay))break}while(n=t.shift());if(this._active=!1,r){for(;n=t.shift();)n.unsubscribe();throw r}}},r}(M))(F),R=new k((function(n){return n.complete()}));function V(n){return n&&l(n.schedule)}function G(n){return n[n.length-1]}var H=function(n){return n&&"number"==typeof n.length&&"function"!=typeof n};function W(n){return l(null==n?void 0:n.then)}function B(n){return l(n[T])}function J(n){return Symbol.asyncIterator&&l(null==n?void 0:n[Symbol.asyncIterator])}function K(n){return new TypeError("You provided "+(null!==n&&"object"==typeof n?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Q="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function X(n){return l(null==n?void 0:n[Q])}function Z(n){return s(this,arguments,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:t=n.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(t.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function $(n){return l(null==n?void 0:n.getReader)}function nn(n){if(n instanceof k)return n;if(null!=n){if(B(n))return i=n,new k((function(n){var t=i[T]();if(l(t.subscribe))return t.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(H(n))return e=n,new k((function(n){for(var t=0;t<e.length&&!n.closed;t++)n.next(e[t]);n.complete()}));if(W(n))return r=n,new k((function(n){r.then((function(t){n.closed||(n.next(t),n.complete())}),(function(t){return n.error(t)})).then(null,w)}));if(J(n))return tn(n);if(X(n))return t=n,new k((function(n){var r,e;try{for(var i=o(t),u=i.next();!u.done;u=i.next()){var c=u.value;if(n.next(c),n.closed)return}}catch(n){r={error:n}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}n.complete()}));if($(n))return tn(Z(n))}var t,r,e,i;throw K(n)}function tn(n){return new k((function(t){(function(n,t){var o,i,u,c;return r(this,void 0,void 0,(function(){var r,s;return e(this,(function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=a(n),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,t.next(r),t.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(n,t).catch((function(n){return t.error(n)}))}))}function rn(n,t,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=t.schedule((function(){r(),o?n.add(this.schedule(null,e)):this.unsubscribe()}),e);if(n.add(i),!o)return i}function en(n,t){return void 0===t&&(t=0),L((function(r,e){r.subscribe(U(e,(function(r){return rn(e,n,(function(){return e.next(r)}),t)}),(function(){return rn(e,n,(function(){return e.complete()}),t)}),(function(r){return rn(e,n,(function(){return e.error(r)}),t)})))}))}function on(n,t){return void 0===t&&(t=0),L((function(r,e){e.add(n.schedule((function(){return r.subscribe(e)}),t))}))}function un(n,t){if(!n)throw new Error("Iterable cannot be null");return new k((function(r){rn(r,t,(function(){var e=n[Symbol.asyncIterator]();rn(r,t,(function(){e.next().then((function(n){n.done?r.complete():r.next(n.value)}))}),0,!0)}))}))}function cn(n,t){if(null!=n){if(B(n))return function(n,t){return nn(n).pipe(on(t),en(t))}(n,t);if(H(n))return function(n,t){return new k((function(r){var e=0;return t.schedule((function(){e===n.length?r.complete():(r.next(n[e++]),r.closed||this.schedule())}))}))}(n,t);if(W(n))return function(n,t){return nn(n).pipe(on(t),en(t))}(n,t);if(J(n))return un(n,t);if(X(n))return function(n,t){return new k((function(r){var e;return rn(r,t,(function(){e=n[Q](),rn(r,t,(function(){var n,t,o;try{t=(n=e.next()).value,o=n.done}catch(n){return void r.error(n)}o?r.complete():r.next(t)}),0,!0)})),function(){return l(null==e?void 0:e.return)&&e.return()}}))}(n,t);if($(n))return function(n,t){return un(Z(n),t)}(n,t)}throw K(n)}function sn(n,t){return t?cn(n,t):nn(n)}var an=f((function(n){return function(){n(this),this.name="EmptyError",this.message="no elements in sequence"}}));function ln(n,t){return L((function(r,e){var o=0;r.subscribe(U(e,(function(r){e.next(n.call(t,r,o++))})))}))}var fn=Array.isArray;function pn(n){return ln((function(t){return function(n,t){return fn(t)?n.apply(void 0,u([],i(t))):n(t)}(n,t)}))}function hn(n,t,r){return void 0===r&&(r=1/0),l(t)?hn((function(r,e){return ln((function(n,o){return t(r,n,e,o)}))(nn(n(r,e)))}),r):("number"==typeof t&&(r=t),L((function(t,e){return function(n,t,r,e,o,i,u,c){var s=[],a=0,l=0,f=!1,p=function(){!f||s.length||a||t.complete()},h=function(n){return a<e?v(n):s.push(n)},v=function(n){i&&t.next(n),a++;var c=!1;nn(r(n,l++)).subscribe(U(t,(function(n){null==o||o(n),i?h(n):t.next(n)}),(function(){c=!0}),void 0,(function(){if(c)try{a--;for(var n=function(){var n=s.shift();u?rn(t,u,(function(){return v(n)})):v(n)};s.length&&a<e;)n();p()}catch(n){t.error(n)}})))};return n.subscribe(U(t,h,(function(){f=!0,p()}))),function(){null==c||c()}}(t,e,n,r)})))}var vn=["addListener","removeListener"],dn=["addEventListener","removeEventListener"],bn=["on","off"];function yn(n,t){return function(r){return function(e){return n[r](t,e)}}}function mn(n,t,r){void 0===n&&(n=0),void 0===r&&(r=q);var e=-1;return null!=t&&(V(t)?r=t:e=t),new k((function(t){var o,i=(o=n)instanceof Date&&!isNaN(o)?+n-r.now():n;i<0&&(i=0);var u=0;return r.schedule((function(){t.closed||(t.next(u++),0<=e?this.schedule(void 0,e):t.complete())}),i)}))}var wn=Array.isArray;function xn(n,t){return L((function(r,e){var o=0;r.subscribe(U(e,(function(r){return n.call(t,r,o++)&&e.next(r)})))}))}function gn(n){return function(t){for(var r=[],e=function(e){r.push(nn(n[e]).subscribe(U(t,(function(n){if(r){for(var o=0;o<r.length;o++)o!==e&&r[o].unsubscribe();r=null}t.next(n)}))))},o=0;r&&!t.closed&&o<n.length;o++)e(o)}}function _n(n){return L((function(t,r){var e=!1;t.subscribe(U(r,(function(n){e=!0,r.next(n)}),(function(){e||r.next(n),r.complete()})))}))}function Sn(n){return void 0===n&&(n=En),L((function(t,r){var e=!1;t.subscribe(U(r,(function(n){e=!0,r.next(n)}),(function(){return e?r.complete():r.error(n())})))}))}function En(){return new an}exports.EMPTY=R,exports.Observable=k,exports.catchError=function n(t){return L((function(r,e){var o,i=null,u=!1;i=r.subscribe(U(e,void 0,void 0,(function(c){o=nn(t(c,n(t)(r))),i?(i.unsubscribe(),i=null,o.subscribe(e)):u=!0}))),u&&(i.unsubscribe(),i=null,o.subscribe(e))}))},exports.defaultIfEmpty=_n,exports.defer=function(n){return new k((function(t){nn(n()).subscribe(t)}))},exports.filter=xn,exports.first=function(n,t){var r=arguments.length>=2;return function(e){return e.pipe(n?xn((function(t,r){return n(t,r,e)})):O,(o=1)<=0?function(){return R}:L((function(n,t){var r=0;n.subscribe(U(t,(function(n){++r<=o&&(t.next(n),o<=r&&t.complete())})))})),r?_n(t):Sn((function(){return new an})));var o}},exports.firstValueFrom=function(n,t){var r="object"==typeof t;return new Promise((function(e,o){var i=new I({next:function(n){e(n),i.unsubscribe()},error:o,complete:function(){r?e(t.defaultValue):o(new an)}});n.subscribe(i)}))},exports.from=sn,exports.fromEvent=function n(t,r,e,o){if(l(e)&&(o=e,e=void 0),o)return n(t,r,e).pipe(pn(o));var u=i(function(n){return l(n.addEventListener)&&l(n.removeEventListener)}(t)?dn.map((function(n){return function(o){return t[n](r,o,e)}})):function(n){return l(n.addListener)&&l(n.removeListener)}(t)?vn.map(yn(t,r)):function(n){return l(n.on)&&l(n.off)}(t)?bn.map(yn(t,r)):[],2),c=u[0],s=u[1];if(!c&&H(t))return hn((function(t){return n(t,r,e)}))(nn(t));if(!c)throw new TypeError("Invalid event target");return new k((function(n){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n.next(1<t.length?t:t[0])};return c(t),function(){return s(t)}}))},exports.identity=O,exports.ignoreElements=function(){return L((function(n,t){n.subscribe(U(t,x))}))},exports.map=ln,exports.merge=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var r=function(n){return V(G(n))?n.pop():void 0}(n),e=function(n,t){return"number"==typeof G(n)?n.pop():t}(n,1/0),o=n;return o.length?1===o.length?nn(o[0]):function(n){return void 0===n&&(n=1/0),hn(O,n)}(e)(sn(o,r)):R},exports.mergeMap=hn,exports.noop=x,exports.pipe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return j(n)},exports.race=function(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 1===(t=1===(n=t).length&&wn(n[0])?n[0]:n).length?nn(t[0]):new k(gn(t))},exports.raceWith=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n.length?L((function(t,r){gn(u([t],i(n)))(r)})):O},exports.retry=function(n){var t;void 0===n&&(n=1/0);var r=(t=n&&"object"==typeof n?n:{count:n}).count,e=void 0===r?1/0:r,o=t.delay,i=t.resetOnSuccess,u=void 0!==i&&i;return e<=0?O:L((function(n,t){var r,i=0,c=function(){var s=!1;r=n.subscribe(U(t,(function(n){u&&(i=0),t.next(n)}),void 0,(function(n){if(i++<e){var u=function(){r?(r.unsubscribe(),r=null,c()):s=!0};if(null!=o){var a="number"==typeof o?mn(o):nn(o(n,i)),l=U(t,(function(){l.unsubscribe(),u()}),(function(){t.complete()}));a.subscribe(l)}else u()}else t.error(n)}))),s&&(r.unsubscribe(),r=null,c())};c()}))},exports.tap=function(n,t,r){var e=l(n)||t||r?{next:n,error:t,complete:r}:n;return e?L((function(n,t){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;n.subscribe(U(t,(function(n){var r;null===(r=e.next)||void 0===r||r.call(e,n),t.next(n)}),(function(){var n;o=!1,null===(n=e.complete)||void 0===n||n.call(e),t.complete()}),(function(n){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,n),t.error(n)}),(function(){var n,t;o&&(null===(n=e.unsubscribe)||void 0===n||n.call(e)),null===(t=e.finalize)||void 0===t||t.call(e)})))})):O},exports.throwIfEmpty=Sn,exports.timer=mn;
"use strict";var n=function(t,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])},n(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(n,t,r,e){return new(r||(r=Promise))((function(o,i){function u(n){try{s(e.next(n))}catch(n){i(n)}}function c(n){try{s(e.throw(n))}catch(n){i(n)}}function s(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(u,c)}s((e=e.apply(n,t||[])).next())}))}function e(n,t){var r,e,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,e=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(n,u)}catch(n){c=[6,n],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(n){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&n[t],e=0;if(r)return r.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&e>=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var e,o,i=r.call(n),u=[];try{for(;(void 0===t||t-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(n){o={error:n}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(n,t,r){if(r||2===arguments.length)for(var e,o=0,i=t.length;o<i;o++)!e&&o in t||(e||(e=Array.prototype.slice.call(t,0,o)),e[o]=t[o]);return n.concat(e||Array.prototype.slice.call(t))}function c(n){return this instanceof c?(this.v=n,this):new c(n)}function s(n,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(n,t||[]),i=[];return e={},u("next"),u("throw"),u("return"),e[Symbol.asyncIterator]=function(){return this},e;function u(n){o[n]&&(e[n]=function(t){return new Promise((function(r,e){i.push([n,t,r,e])>1||s(n,t)}))})}function s(n,t){try{(r=o[n](t)).value instanceof c?Promise.resolve(r.value.v).then(l,a):f(i[0][2],r)}catch(n){f(i[0][3],n)}var r}function l(n){s("next",n)}function a(n){s("throw",n)}function f(n,t){n(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function l(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=n[Symbol.asyncIterator];return r?r.call(n):(n=o(n),t={},e("next"),e("throw"),e("return"),t[Symbol.asyncIterator]=function(){return this},t);function e(r){t[r]=n[r]&&function(t){return new Promise((function(e,o){(function(n,t,r,e){Promise.resolve(e).then((function(t){n({value:t,done:r})}),t)})(e,o,(t=n[r](t)).done,t.value)}))}}}function a(n){return"function"==typeof n}function f(n){var t=n((function(n){Error.call(n),n.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var p=f((function(n){return function(t){n(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(n,t){return t+1+") "+n.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function h(n,t){if(n){var r=n.indexOf(t);0<=r&&n.splice(r,1)}}var v=function(){function n(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return n.prototype.unsubscribe=function(){var n,t,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var l=o(s),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(t){n={error:t}}finally{try{f&&!f.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}else s.remove(this);var h=this.initialTeardown;if(a(h))try{h()}catch(n){c=n instanceof p?n.errors:[n]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var d=o(v),b=d.next();!b.done;b=d.next()){var m=b.value;try{y(m)}catch(n){c=null!=c?c:[],n instanceof p?c=u(u([],i(c)),i(n.errors)):c.push(n)}}}catch(n){r={error:n}}finally{try{b&&!b.done&&(e=d.return)&&e.call(d)}finally{if(r)throw r.error}}}if(c)throw new p(c)}},n.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)y(t);else{if(t instanceof n){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},n.prototype._hasParent=function(n){var t=this._parentage;return t===n||Array.isArray(t)&&t.includes(n)},n.prototype._addParent=function(n){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(n),t):t?[t,n]:n},n.prototype._removeParent=function(n){var t=this._parentage;t===n?this._parentage=null:Array.isArray(t)&&h(t,n)},n.prototype.remove=function(t){var r=this._finalizers;r&&h(r,t),t instanceof n&&t._removeParent(this)},n.EMPTY=((t=new n).closed=!0,t),n}();function d(n){return n instanceof v||n&&"closed"in n&&a(n.remove)&&a(n.add)&&a(n.unsubscribe)}function y(n){a(n)?n():n.unsubscribe()}v.EMPTY;var b={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},m={setTimeout:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=m.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,u([n,t],i(r))):setTimeout.apply(void 0,u([n,t],i(r)))},clearTimeout:function(n){var t=m.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(n)},delegate:void 0};function w(n){m.setTimeout((function(){throw n}))}function x(){}var g=function(n){function r(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,d(t)&&t.add(r)):r.destination=P,r}return t(r,n),r.create=function(n,t,r){return new I(n,t,r)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(v),_=Function.prototype.bind;function S(n,t){return _.call(n,t)}var E=function(){function n(n){this.partialObserver=n}return n.prototype.next=function(n){var t=this.partialObserver;if(t.next)try{t.next(n)}catch(n){A(n)}},n.prototype.error=function(n){var t=this.partialObserver;if(t.error)try{t.error(n)}catch(n){A(n)}else A(n)},n.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){A(n)}},n}(),I=function(n){function r(t,r,e){var o,i,u=n.call(this)||this;a(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:u&&b.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},o={next:t.next&&S(t.next,i),error:t.error&&S(t.error,i),complete:t.complete&&S(t.complete,i)}):o=t;return u.destination=new E(o),u}return t(r,n),r}(g);function A(n){w(n)}var P={closed:!0,next:x,error:function(n){throw n},complete:x},T="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(n){return n}function j(n){return 0===n.length?O:1===n.length?n[0]:function(t){return n.reduce((function(n,t){return t(n)}),t)}}var k=function(){function n(n){n&&(this._subscribe=n)}return n.prototype.lift=function(t){var r=new n;return r.source=this,r.operator=t,r},n.prototype.subscribe=function(n,t,r){var e,o=this,i=(e=n)&&e instanceof g||function(n){return n&&a(n.next)&&a(n.error)&&a(n.complete)}(e)&&d(e)?n:new I(n,t,r);return function(){var n=o,t=n.operator,r=n.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},n.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(t){n.error(t)}},n.prototype.forEach=function(n,t){var r=this;return new(t=z(t))((function(t,e){var o=new I({next:function(t){try{n(t)}catch(n){e(n),o.unsubscribe()}},error:e,complete:t});r.subscribe(o)}))},n.prototype._subscribe=function(n){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(n)},n.prototype[T]=function(){return this},n.prototype.pipe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return j(n)(this)},n.prototype.toPromise=function(n){var t=this;return new(n=z(n))((function(n,r){var e;t.subscribe((function(n){return e=n}),(function(n){return r(n)}),(function(){return n(e)}))}))},n.create=function(t){return new n(t)},n}();function z(n){var t;return null!==(t=null!=n?n:b.Promise)&&void 0!==t?t:Promise}function L(n){return function(t){if(function(n){return a(null==n?void 0:n.lift)}(t))return t.lift((function(t){try{return n(t,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}function U(n,t,r,e,o){return new C(n,t,r,e,o)}var C=function(n){function r(t,r,e,o,i,u){var c=n.call(this,t)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(n){try{r(n)}catch(n){t.error(n)}}:n.prototype._next,c._error=o?function(n){try{o(n)}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._error,c._complete=e?function(){try{e()}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._complete,c}return t(r,n),r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;n.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},r}(g),D={now:function(){return(D.delegate||Date).now()},delegate:void 0},N=function(n){function r(t,r){return n.call(this)||this}return t(r,n),r.prototype.schedule=function(n,t){return this},r}(v),Y={setInterval:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=Y.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,u([n,t],i(r))):setInterval.apply(void 0,u([n,t],i(r)))},clearInterval:function(n){var t=Y.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(n)},delegate:void 0},F=function(n){function r(t,r){var e=n.call(this,t,r)||this;return e.scheduler=t,e.work=r,e.pending=!1,e}return t(r,n),r.prototype.schedule=function(n,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=n;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},r.prototype.requestAsyncId=function(n,t,r){return void 0===r&&(r=0),Y.setInterval(n.flush.bind(n,this),r)},r.prototype.recycleAsyncId=function(n,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&Y.clearInterval(t)},r.prototype.execute=function(n,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(n,t){var r,e=!1;try{this.work(n)}catch(n){e=!0,r=n||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,h(e,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,n.prototype.unsubscribe.call(this)}},r}(N),M=function(){function n(t,r){void 0===r&&(r=n.now),this.schedulerActionCtor=t,this.now=r}return n.prototype.schedule=function(n,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,n).schedule(r,t)},n.now=D.now,n}(),q=new(function(n){function r(t,r){void 0===r&&(r=M.now);var e=n.call(this,t,r)||this;return e.actions=[],e._active=!1,e}return t(r,n),r.prototype.flush=function(n){var t=this.actions;if(this._active)t.push(n);else{var r;this._active=!0;do{if(r=n.execute(n.state,n.delay))break}while(n=t.shift());if(this._active=!1,r){for(;n=t.shift();)n.unsubscribe();throw r}}},r}(M))(F),R=new k((function(n){return n.complete()}));function V(n){return n&&a(n.schedule)}function G(n){return n[n.length-1]}var H=function(n){return n&&"number"==typeof n.length&&"function"!=typeof n};function W(n){return a(null==n?void 0:n.then)}function B(n){return a(n[T])}function J(n){return Symbol.asyncIterator&&a(null==n?void 0:n[Symbol.asyncIterator])}function K(n){return new TypeError("You provided "+(null!==n&&"object"==typeof n?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Q="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function X(n){return a(null==n?void 0:n[Q])}function Z(n){return s(this,arguments,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:t=n.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(t.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function $(n){return a(null==n?void 0:n.getReader)}function nn(n){if(n instanceof k)return n;if(null!=n){if(B(n))return i=n,new k((function(n){var t=i[T]();if(a(t.subscribe))return t.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(H(n))return e=n,new k((function(n){for(var t=0;t<e.length&&!n.closed;t++)n.next(e[t]);n.complete()}));if(W(n))return r=n,new k((function(n){r.then((function(t){n.closed||(n.next(t),n.complete())}),(function(t){return n.error(t)})).then(null,w)}));if(J(n))return tn(n);if(X(n))return t=n,new k((function(n){var r,e;try{for(var i=o(t),u=i.next();!u.done;u=i.next()){var c=u.value;if(n.next(c),n.closed)return}}catch(n){r={error:n}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}n.complete()}));if($(n))return tn(Z(n))}var t,r,e,i;throw K(n)}function tn(n){return new k((function(t){(function(n,t){var o,i,u,c;return r(this,void 0,void 0,(function(){var r,s;return e(this,(function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=l(n),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,t.next(r),t.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(n,t).catch((function(n){return t.error(n)}))}))}function rn(n,t,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=t.schedule((function(){r(),o?n.add(this.schedule(null,e)):this.unsubscribe()}),e);if(n.add(i),!o)return i}function en(n,t){return void 0===t&&(t=0),L((function(r,e){r.subscribe(U(e,(function(r){return rn(e,n,(function(){return e.next(r)}),t)}),(function(){return rn(e,n,(function(){return e.complete()}),t)}),(function(r){return rn(e,n,(function(){return e.error(r)}),t)})))}))}function on(n,t){return void 0===t&&(t=0),L((function(r,e){e.add(n.schedule((function(){return r.subscribe(e)}),t))}))}function un(n,t){if(!n)throw new Error("Iterable cannot be null");return new k((function(r){rn(r,t,(function(){var e=n[Symbol.asyncIterator]();rn(r,t,(function(){e.next().then((function(n){n.done?r.complete():r.next(n.value)}))}),0,!0)}))}))}function cn(n,t){if(null!=n){if(B(n))return function(n,t){return nn(n).pipe(on(t),en(t))}(n,t);if(H(n))return function(n,t){return new k((function(r){var e=0;return t.schedule((function(){e===n.length?r.complete():(r.next(n[e++]),r.closed||this.schedule())}))}))}(n,t);if(W(n))return function(n,t){return nn(n).pipe(on(t),en(t))}(n,t);if(J(n))return un(n,t);if(X(n))return function(n,t){return new k((function(r){var e;return rn(r,t,(function(){e=n[Q](),rn(r,t,(function(){var n,t,o;try{t=(n=e.next()).value,o=n.done}catch(n){return void r.error(n)}o?r.complete():r.next(t)}),0,!0)})),function(){return a(null==e?void 0:e.return)&&e.return()}}))}(n,t);if($(n))return function(n,t){return un(Z(n),t)}(n,t)}throw K(n)}function sn(n,t){return t?cn(n,t):nn(n)}var ln=f((function(n){return function(){n(this),this.name="EmptyError",this.message="no elements in sequence"}}));function an(n,t){return L((function(r,e){var o=0;r.subscribe(U(e,(function(r){e.next(n.call(t,r,o++))})))}))}var fn=Array.isArray;function pn(n){return an((function(t){return function(n,t){return fn(t)?n.apply(void 0,u([],i(t))):n(t)}(n,t)}))}function hn(n,t,r){return void 0===r&&(r=1/0),a(t)?hn((function(r,e){return an((function(n,o){return t(r,n,e,o)}))(nn(n(r,e)))}),r):("number"==typeof t&&(r=t),L((function(t,e){return function(n,t,r,e,o,i,u,c){var s=[],l=0,a=0,f=!1,p=function(){!f||s.length||l||t.complete()},h=function(n){return l<e?v(n):s.push(n)},v=function(n){i&&t.next(n),l++;var c=!1;nn(r(n,a++)).subscribe(U(t,(function(n){null==o||o(n),i?h(n):t.next(n)}),(function(){c=!0}),void 0,(function(){if(c)try{l--;for(var n=function(){var n=s.shift();u?rn(t,u,(function(){return v(n)})):v(n)};s.length&&l<e;)n();p()}catch(n){t.error(n)}})))};return n.subscribe(U(t,h,(function(){f=!0,p()}))),function(){null==c||c()}}(t,e,n,r)})))}var vn=["addListener","removeListener"],dn=["addEventListener","removeEventListener"],yn=["on","off"];function bn(n,t){return function(r){return function(e){return n[r](t,e)}}}function mn(n,t,r){void 0===n&&(n=0),void 0===r&&(r=q);var e=-1;return null!=t&&(V(t)?r=t:e=t),new k((function(t){var o,i=(o=n)instanceof Date&&!isNaN(o)?+n-r.now():n;i<0&&(i=0);var u=0;return r.schedule((function(){t.closed||(t.next(u++),0<=e?this.schedule(void 0,e):t.complete())}),i)}))}var wn=Array.isArray;function xn(n,t){return L((function(r,e){var o=0;r.subscribe(U(e,(function(r){return n.call(t,r,o++)&&e.next(r)})))}))}function gn(n){return function(t){for(var r=[],e=function(e){r.push(nn(n[e]).subscribe(U(t,(function(n){if(r){for(var o=0;o<r.length;o++)o!==e&&r[o].unsubscribe();r=null}t.next(n)}))))},o=0;r&&!t.closed&&o<n.length;o++)e(o)}}function _n(n){return L((function(t,r){var e=!1;t.subscribe(U(r,(function(n){e=!0,r.next(n)}),(function(){e||r.next(n),r.complete()})))}))}function Sn(n){return void 0===n&&(n=En),L((function(t,r){var e=!1;t.subscribe(U(r,(function(n){e=!0,r.next(n)}),(function(){return e?r.complete():r.error(n())})))}))}function En(){return new ln}exports.EMPTY=R,exports.Observable=k,exports.catchError=function n(t){return L((function(r,e){var o,i=null,u=!1;i=r.subscribe(U(e,void 0,void 0,(function(c){o=nn(t(c,n(t)(r))),i?(i.unsubscribe(),i=null,o.subscribe(e)):u=!0}))),u&&(i.unsubscribe(),i=null,o.subscribe(e))}))},exports.defaultIfEmpty=_n,exports.defer=function(n){return new k((function(t){nn(n()).subscribe(t)}))},exports.filter=xn,exports.filterAsync=function(n){return hn((t=>sn(Promise.resolve(n(t))).pipe(xn((n=>n)),an((()=>t)))))},exports.first=function(n,t){var r=arguments.length>=2;return function(e){return e.pipe(n?xn((function(t,r){return n(t,r,e)})):O,(o=1)<=0?function(){return R}:L((function(n,t){var r=0;n.subscribe(U(t,(function(n){++r<=o&&(t.next(n),o<=r&&t.complete())})))})),r?_n(t):Sn((function(){return new ln})));var o}},exports.firstValueFrom=function(n,t){var r="object"==typeof t;return new Promise((function(e,o){var i=new I({next:function(n){e(n),i.unsubscribe()},error:o,complete:function(){r?e(t.defaultValue):o(new ln)}});n.subscribe(i)}))},exports.from=sn,exports.fromEvent=function n(t,r,e,o){if(a(e)&&(o=e,e=void 0),o)return n(t,r,e).pipe(pn(o));var u=i(function(n){return a(n.addEventListener)&&a(n.removeEventListener)}(t)?dn.map((function(n){return function(o){return t[n](r,o,e)}})):function(n){return a(n.addListener)&&a(n.removeListener)}(t)?vn.map(bn(t,r)):function(n){return a(n.on)&&a(n.off)}(t)?yn.map(bn(t,r)):[],2),c=u[0],s=u[1];if(!c&&H(t))return hn((function(t){return n(t,r,e)}))(nn(t));if(!c)throw new TypeError("Invalid event target");return new k((function(n){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n.next(1<t.length?t:t[0])};return c(t),function(){return s(t)}}))},exports.identity=O,exports.ignoreElements=function(){return L((function(n,t){n.subscribe(U(t,x))}))},exports.map=an,exports.merge=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var r=function(n){return V(G(n))?n.pop():void 0}(n),e=function(n,t){return"number"==typeof G(n)?n.pop():t}(n,1/0),o=n;return o.length?1===o.length?nn(o[0]):function(n){return void 0===n&&(n=1/0),hn(O,n)}(e)(sn(o,r)):R},exports.mergeMap=hn,exports.noop=x,exports.pipe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return j(n)},exports.race=function(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 1===(t=1===(n=t).length&&wn(n[0])?n[0]:n).length?nn(t[0]):new k(gn(t))},exports.raceWith=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n.length?L((function(t,r){gn(u([t],i(n)))(r)})):O},exports.retry=function(n){var t;void 0===n&&(n=1/0);var r=(t=n&&"object"==typeof n?n:{count:n}).count,e=void 0===r?1/0:r,o=t.delay,i=t.resetOnSuccess,u=void 0!==i&&i;return e<=0?O:L((function(n,t){var r,i=0,c=function(){var s=!1;r=n.subscribe(U(t,(function(n){u&&(i=0),t.next(n)}),void 0,(function(n){if(i++<e){var u=function(){r?(r.unsubscribe(),r=null,c()):s=!0};if(null!=o){var l="number"==typeof o?mn(o):nn(o(n,i)),a=U(t,(function(){a.unsubscribe(),u()}),(function(){t.complete()}));l.subscribe(a)}else u()}else t.error(n)}))),s&&(r.unsubscribe(),r=null,c())};c()}))},exports.tap=function(n,t,r){var e=a(n)||t||r?{next:n,error:t,complete:r}:n;return e?L((function(n,t){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;n.subscribe(U(t,(function(n){var r;null===(r=e.next)||void 0===r||r.call(e,n),t.next(n)}),(function(){var n;o=!1,null===(n=e.complete)||void 0===n||n.call(e),t.complete()}),(function(n){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,n),t.error(n)}),(function(){var n,t;o&&(null===(n=e.unsubscribe)||void 0===n||n.call(e)),null===(t=e.finalize)||void 0===t||t.call(e)})))})):O},exports.throwIfEmpty=Sn,exports.timer=mn;

@@ -19,8 +19,6 @@ /**

import { Frame } from '../api/Frame.js';
import { CDPSession } from '../common/Connection.js';
import { ExecutionContext } from '../common/ExecutionContext.js';
import { WaitForSelectorOptions } from '../common/IsolatedWorld.js';
import { ElementFor, EvaluateFuncWith, HandleFor, HandleOr, NodeFor } from '../common/types.js';
import { KeyInput } from '../common/USKeyboardLayout.js';
import { KeyPressOptions, MouseClickOptions, KeyboardTypeOptions } from './Input.js';
import { KeyboardTypeOptions, KeyPressOptions, MouseClickOptions } from './Input.js';
import { JSHandle } from './JSHandle.js';

@@ -31,7 +29,11 @@ import { ScreenshotOptions } from './Page.js';

*/
export type Quad = [Point, Point, Point, Point];
/**
* @public
*/
export interface BoxModel {
content: Point[];
padding: Point[];
border: Point[];
margin: Point[];
content: Quad;
padding: Quad;
border: Quad;
margin: Quad;
width: number;

@@ -115,3 +117,3 @@ height: number;

*/
export declare class ElementHandle<ElementType extends Node = Element> extends JSHandle<ElementType> {
export declare abstract class ElementHandle<ElementType extends Node = Element> extends JSHandle<ElementType> {
#private;

@@ -165,13 +167,12 @@ /**

*/
dispose(): Promise<void>;
asElement(): ElementHandle<ElementType>;
remoteObject(): Protocol.Runtime.RemoteObject;
/**
* @internal
*/
executionContext(): ExecutionContext;
dispose(): Promise<void>;
asElement(): ElementHandle<ElementType>;
/**
* @internal
* Frame corresponding to the current handle.
*/
get client(): CDPSession;
get frame(): Frame;
abstract get frame(): Frame;
/**

@@ -392,5 +393,4 @@ * Queries the current element for an element matching the given selector.

* // DO NOT DISPOSE `element`, this will be always be the same handle.
* const anchor: ElementHandle<HTMLAnchorElement> = await element.toElement(
* 'a'
* );
* const anchor: ElementHandle<HTMLAnchorElement> =
* await element.toElement('a');
* ```

@@ -404,6 +404,7 @@ *

/**
* Resolves to the content frame for element handles referencing
* iframe nodes, or null otherwise
* Resolves the frame associated with the element, if any. Always exists for
* HTMLIFrameElements.
*/
contentFrame(): Promise<Frame | null>;
abstract contentFrame(this: ElementHandle<HTMLIFrameElement>): Promise<Frame>;
abstract contentFrame(): Promise<Frame | null>;
/**

@@ -424,3 +425,3 @@ * Returns the middle point within an element unless a specific offset is provided.

*/
click(this: ElementHandle<Element>, options?: ClickOptions): Promise<void>;
click(this: ElementHandle<Element>, options?: Readonly<ClickOptions>): Promise<void>;
/**

@@ -578,3 +579,3 @@ * This method creates and captures a dragevent from the element.

*/
assertElementHasWorld(): asserts this;
abstract assertElementHasWorld(): asserts this;
/**

@@ -605,3 +606,3 @@ * If the element is a form input, you can use {@link ElementHandle.autofill}

*/
autofill(data: AutofillData): Promise<void>;
abstract autofill(data: AutofillData): Promise<void>;
}

@@ -608,0 +609,0 @@ /**

@@ -18,3 +18,3 @@ /**

import { LazyArg } from '../common/LazyArg.js';
import { isString, withSourcePuppeteerURLIfNone } from '../common/util.js';
import { debugError, isString, withSourcePuppeteerURLIfNone, } from '../common/util.js';
import { assert } from '../util/assert.js';

@@ -116,2 +116,8 @@ import { AsyncIterableUtil } from '../util/AsyncIterableUtil.js';

*/
remoteObject() {
return this.handle.remoteObject();
}
/**
* @internal
*/
async dispose() {

@@ -124,17 +130,2 @@ return await this.handle.dispose();

/**
* @internal
*/
executionContext() {
throw new Error('Not implemented');
}
/**
* @internal
*/
get client() {
throw new Error('Not implemented');
}
get frame() {
throw new Error('Not implemented');
}
/**
* Queries the current element for an element matching the given selector.

@@ -409,5 +400,4 @@ *

* // DO NOT DISPOSE `element`, this will be always be the same handle.
* const anchor: ElementHandle<HTMLAnchorElement> = await element.toElement(
* 'a'
* );
* const anchor: ElementHandle<HTMLAnchorElement> =
* await element.toElement('a');
* ```

@@ -429,11 +419,20 @@ *

/**
* Resolves to the content frame for element handles referencing
* iframe nodes, or null otherwise
* Returns the middle point within an element unless a specific offset is provided.
*/
async contentFrame() {
throw new Error('Not implemented');
async clickablePoint(offset) {
const box = await this.#clickableBox();
if (!box) {
throw new Error('Node is either not clickable or not an Element');
}
if (offset !== undefined) {
return {
x: box.x + offset.x,
y: box.y + offset.y,
};
}
return {
x: box.x + box.width / 2,
y: box.y + box.height / 2,
};
}
async clickablePoint() {
throw new Error('Not implemented');
}
/**

@@ -445,6 +444,15 @@ * This method scrolls element into view if needed, and then

async hover() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().mouse.move(x, y);
}
async click() {
throw new Error('Not implemented');
/**
* This method scrolls element into view if needed, and then
* uses {@link Page | Page.mouse} to click in the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
async click(options = {}) {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint(options.offset);
await this.frame.page().mouse.click(x, y, options);
}

@@ -530,12 +538,20 @@ async drag() {

async tap() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().touchscreen.touchStart(x, y);
await this.frame.page().touchscreen.touchEnd();
}
async touchStart() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().touchscreen.touchStart(x, y);
}
async touchMove() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.frame.page().touchscreen.touchMove(x, y);
}
async touchEnd() {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
await this.frame.page().touchscreen.touchEnd();
}

@@ -553,8 +569,125 @@ /**

}
async type() {
throw new Error('Not implemented');
/**
* Focuses the element, and then sends a `keydown`, `keypress`/`input`, and
* `keyup` event for each character in the text.
*
* To press a special key, like `Control` or `ArrowDown`,
* use {@link ElementHandle.press}.
*
* @example
*
* ```ts
* await elementHandle.type('Hello'); // Types instantly
* await elementHandle.type('World', {delay: 100}); // Types slower, like a user
* ```
*
* @example
* An example of typing into a text field and then submitting the form:
*
* ```ts
* const elementHandle = await page.$('input');
* await elementHandle.type('some text');
* await elementHandle.press('Enter');
* ```
*
* @param options - Delay in milliseconds. Defaults to 0.
*/
async type(text, options) {
await this.focus();
await this.frame.page().keyboard.type(text, options);
}
async press() {
throw new Error('Not implemented');
/**
* Focuses the element, and then uses {@link Keyboard.down} and {@link Keyboard.up}.
*
* @remarks
* If `key` is a single character and no modifier keys besides `Shift`
* are being held down, a `keypress`/`input` event will also be generated.
* The `text` option can be specified to force an input event to be generated.
*
* **NOTE** Modifier keys DO affect `elementHandle.press`. Holding down `Shift`
* will type the text in upper case.
*
* @param key - Name of key to press, such as `ArrowLeft`.
* See {@link KeyInput} for a list of all key names.
*/
async press(key, options) {
await this.focus();
await this.frame.page().keyboard.press(key, options);
}
async #clickableBox() {
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const boxes = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
return [...element.getClientRects()].map(rect => {
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
});
});
void adoptedThis.dispose().catch(debugError);
if (!boxes?.length) {
return null;
}
await this.#intersectBoundingBoxesWithFrame(boxes);
let frame = this.frame;
let element;
while ((element = await frame?.frameElement())) {
try {
element = await element.frame.isolatedRealm().transferHandle(element);
const parentBox = await element.evaluate(element => {
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
return {
left: rect.left +
parseInt(style.paddingLeft, 10) +
parseInt(style.borderLeftWidth, 10),
top: rect.top +
parseInt(style.paddingTop, 10) +
parseInt(style.borderTopWidth, 10),
};
});
if (!parentBox) {
return null;
}
for (const box of boxes) {
box.x += parentBox.left;
box.y += parentBox.top;
}
await element.#intersectBoundingBoxesWithFrame(boxes);
frame = frame?.parentFrame();
}
finally {
void element.dispose().catch(debugError);
}
}
const box = boxes.find(box => {
return box.width >= 1 && box.height >= 1;
});
if (!box) {
return null;
}
return {
x: box.x,
y: box.y,
height: box.height,
width: box.width,
};
}
async #intersectBoundingBoxesWithFrame(boxes) {
const { documentWidth, documentHeight } = await this.frame
.isolatedRealm()
.evaluate(() => {
return {
documentWidth: document.documentElement.clientWidth,
documentHeight: document.documentElement.clientHeight,
};
});
for (const box of boxes) {
intersectBoundingBox(box, documentWidth, documentHeight);
}
}
/**

@@ -565,3 +698,28 @@ * This method returns the bounding box of the element (relative to the main frame),

async boundingBox() {
throw new Error('Not implemented');
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const box = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
});
void adoptedThis.dispose().catch(debugError);
if (!box) {
return null;
}
const offset = await this.#getTopLeftCornerOfFrame();
if (!offset) {
return null;
}
return {
x: box.x + offset.x,
y: box.y + offset.y,
height: box.height,
width: box.width,
};
}

@@ -577,4 +735,128 @@ /**

async boxModel() {
throw new Error('Not implemented');
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const model = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
const offsets = {
padding: {
left: parseInt(style.paddingLeft, 10),
top: parseInt(style.paddingTop, 10),
right: parseInt(style.paddingRight, 10),
bottom: parseInt(style.paddingBottom, 10),
},
margin: {
left: -parseInt(style.marginLeft, 10),
top: -parseInt(style.marginTop, 10),
right: -parseInt(style.marginRight, 10),
bottom: -parseInt(style.marginBottom, 10),
},
border: {
left: parseInt(style.borderLeft, 10),
top: parseInt(style.borderTop, 10),
right: parseInt(style.borderRight, 10),
bottom: parseInt(style.borderBottom, 10),
},
};
const border = [
{ x: rect.left, y: rect.top },
{ x: rect.left + rect.width, y: rect.top },
{ x: rect.left + rect.width, y: rect.top + rect.bottom },
{ x: rect.left, y: rect.top + rect.bottom },
];
const padding = transformQuadWithOffsets(border, offsets.border);
const content = transformQuadWithOffsets(padding, offsets.padding);
const margin = transformQuadWithOffsets(border, offsets.margin);
return {
content,
padding,
border,
margin,
width: rect.width,
height: rect.height,
};
function transformQuadWithOffsets(quad, offsets) {
return [
{
x: quad[0].x + offsets.left,
y: quad[0].y + offsets.top,
},
{
x: quad[1].x - offsets.right,
y: quad[1].y + offsets.top,
},
{
x: quad[2].x - offsets.right,
y: quad[2].y - offsets.bottom,
},
{
x: quad[3].x + offsets.left,
y: quad[3].y - offsets.bottom,
},
];
}
});
void adoptedThis.dispose().catch(debugError);
if (!model) {
return null;
}
const offset = await this.#getTopLeftCornerOfFrame();
if (!offset) {
return null;
}
for (const attribute of [
'content',
'padding',
'border',
'margin',
]) {
for (const point of model[attribute]) {
point.x += offset.x;
point.y += offset.y;
}
}
return model;
}
async #getTopLeftCornerOfFrame() {
const point = { x: 0, y: 0 };
let frame = this.frame;
let element;
while ((element = await frame?.frameElement())) {
try {
element = await element.frame.isolatedRealm().transferHandle(element);
const parentBox = await element.evaluate(element => {
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
return {
left: rect.left +
parseInt(style.paddingLeft, 10) +
parseInt(style.borderLeftWidth, 10),
top: rect.top +
parseInt(style.paddingTop, 10) +
parseInt(style.borderTopWidth, 10),
};
});
if (!parentBox) {
return null;
}
point.x += parentBox.left;
point.y += parentBox.top;
frame = frame?.parentFrame();
}
finally {
void element.dispose().catch(debugError);
}
}
return point;
}
async screenshot() {

@@ -681,12 +963,11 @@ throw new Error('Not implemented');

}
/**
* @internal
*/
assertElementHasWorld() {
assert(this.executionContext()._world);
}
autofill() {
throw new Error('Not implemented');
}
}
function intersectBoundingBox(box, width, height) {
box.width = Math.max(box.x >= 0
? Math.min(width - box.x, box.width)
: Math.min(width, box.width + box.x), 0);
box.height = Math.max(box.y >= 0
? Math.min(height - box.y, box.height)
: Math.min(height, box.height + box.y), 0);
}
//# sourceMappingURL=ElementHandle.js.map

@@ -303,2 +303,6 @@ /**

/**
* @internal
*/
frameElement(): Promise<HandleFor<HTMLIFrameElement> | null>;
/**
* Behaves identically to {@link Page.evaluateHandle} except it's run within

@@ -305,0 +309,0 @@ * the context of this frame.

@@ -18,4 +18,5 @@ /**

import { getQueryHandlerAndSelector } from '../common/GetQueryHandler.js';
import { transposeIterableHandle } from '../common/HandleIterator.js';
import { LazyArg } from '../common/LazyArg.js';
import { importFSPromises } from '../common/util.js';
import { debugError, importFSPromises } from '../common/util.js';
import { FunctionLocator, NodeLocator } from './locators/locators.js';

@@ -145,2 +146,22 @@ /**

}
/**
* @internal
*/
async frameElement() {
const parentFrame = this.parentFrame();
if (!parentFrame) {
return null;
}
const list = await parentFrame.isolatedRealm().evaluateHandle(() => {
return document.querySelectorAll('iframe');
});
for await (const iframe of transposeIterableHandle(list)) {
const frame = await iframe.contentFrame();
if (frame._id === this._id) {
return iframe;
}
void iframe.dispose().catch(debugError);
}
return null;
}
async evaluateHandle() {

@@ -147,0 +168,0 @@ throw new Error('Not implemented');

@@ -17,4 +17,2 @@ /**

import Protocol from 'devtools-protocol';
import { CDPSession } from '../common/Connection.js';
import { ExecutionContext } from '../common/ExecutionContext.js';
import { EvaluateFuncWith, HandleFor, HandleOr } from '../common/types.js';

@@ -43,3 +41,3 @@ import { ElementHandle } from './ElementHandle.js';

*/
export declare class JSHandle<T = unknown> {
export declare abstract class JSHandle<T = unknown> {
/**

@@ -58,13 +56,5 @@ * Used for nominally typing {@link JSHandle}.

/**
* @internal
*/
executionContext(): ExecutionContext;
/**
* @internal
*/
get client(): CDPSession;
/**
* Evaluates the given function with the current handle as its first argument.
*/
evaluate<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
abstract evaluate<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
/**

@@ -74,9 +64,8 @@ * Evaluates the given function with the current handle as its first argument.

*/
evaluateHandle<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
abstract evaluateHandle<Params extends unknown[], Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>>(pageFunction: Func | string, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
/**
* Fetches a single property from the referenced object.
*/
getProperty<K extends keyof T>(propertyName: HandleOr<K>): Promise<HandleFor<T[K]>>;
getProperty(propertyName: string): Promise<JSHandle<unknown>>;
getProperty<K extends keyof T>(propertyName: HandleOr<K>): Promise<HandleFor<T[K]>>;
abstract getProperty<K extends keyof T>(propertyName: HandleOr<K>): Promise<HandleFor<T[K]>>;
abstract getProperty(propertyName: string): Promise<JSHandle<unknown>>;
/**

@@ -100,3 +89,3 @@ * Gets a map of handles representing the properties of the current handle.

*/
getProperties(): Promise<Map<string, JSHandle>>;
abstract getProperties(): Promise<Map<string, JSHandle<unknown>>>;
/**

@@ -110,3 +99,3 @@ * A vanilla object representing the serializable portions of the

*/
jsonValue(): Promise<T>;
abstract jsonValue(): Promise<T>;
/**

@@ -116,7 +105,7 @@ * Either `null` or the handle itself if the handle is an

*/
asElement(): ElementHandle<Node> | null;
abstract asElement(): ElementHandle<Node> | null;
/**
* Releases the object referenced by the handle for garbage collection.
*/
dispose(): Promise<void>;
abstract dispose(): Promise<void>;
/**

@@ -128,7 +117,7 @@ * Returns a string representation of the JSHandle.

*/
toString(): string;
abstract toString(): string;
/**
* @internal
*/
get id(): string | undefined;
abstract get id(): string | undefined;
/**

@@ -139,4 +128,4 @@ * Provides access to the

*/
remoteObject(): Protocol.Runtime.RemoteObject;
abstract remoteObject(): Protocol.Runtime.RemoteObject;
}
//# sourceMappingURL=JSHandle.d.ts.map

@@ -48,92 +48,3 @@ /**

}
/**
* @internal
*/
executionContext() {
throw new Error('Not implemented');
}
/**
* @internal
*/
get client() {
throw new Error('Not implemented');
}
async evaluate() {
throw new Error('Not implemented');
}
async evaluateHandle() {
throw new Error('Not implemented');
}
async getProperty() {
throw new Error('Not implemented');
}
/**
* Gets a map of handles representing the properties of the current handle.
*
* @example
*
* ```ts
* const listHandle = await page.evaluateHandle(() => document.body.children);
* const properties = await listHandle.getProperties();
* const children = [];
* for (const property of properties.values()) {
* const element = property.asElement();
* if (element) {
* children.push(element);
* }
* }
* children; // holds elementHandles to all children of document.body
* ```
*/
async getProperties() {
throw new Error('Not implemented');
}
/**
* A vanilla object representing the serializable portions of the
* referenced object.
* @throws Throws if the object cannot be serialized due to circularity.
*
* @remarks
* If the object has a `toJSON` function, it **will not** be called.
*/
async jsonValue() {
throw new Error('Not implemented');
}
/**
* Either `null` or the handle itself if the handle is an
* instance of {@link ElementHandle}.
*/
asElement() {
throw new Error('Not implemented');
}
/**
* Releases the object referenced by the handle for garbage collection.
*/
async dispose() {
throw new Error('Not implemented');
}
/**
* Returns a string representation of the JSHandle.
*
* @remarks
* Useful during debugging.
*/
toString() {
throw new Error('Not implemented');
}
/**
* @internal
*/
get id() {
throw new Error('Not implemented');
}
/**
* Provides access to the
* {@link https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject | Protocol.Runtime.RemoteObject}
* backing this handle.
*/
remoteObject() {
throw new Error('Not implemented');
}
}
//# sourceMappingURL=JSHandle.js.map

@@ -240,5 +240,5 @@ /**

}), mergeMap(handle => {
return from(handle.click(options)).pipe(catchError((_, caught) => {
return from(handle.click(options)).pipe(catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
}));

@@ -336,5 +336,5 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

}))
.pipe(catchError((_, caught) => {
.pipe(catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
}));

@@ -351,5 +351,5 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

}), mergeMap(handle => {
return from(handle.hover()).pipe(catchError((_, caught) => {
return from(handle.hover()).pipe(catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
}));

@@ -373,5 +373,5 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

}
}, options?.scrollTop, options?.scrollLeft)).pipe(catchError((_, caught) => {
}, options?.scrollTop, options?.scrollLeft)).pipe(catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
}));

@@ -378,0 +378,0 @@ }), this.operators.retryAndRaceWithSignalAndTimer(signal));

@@ -16,2 +16,4 @@ /**

*/
import { filterAsync, first, firstValueFrom, from, fromEvent, map, merge, raceWith, timer, } from '../../third_party/rxjs/rxjs.js';
import { TargetCloseError, TimeoutError } from '../common/Errors.js';
import { EventEmitter } from '../common/EventEmitter.js';

@@ -619,4 +621,25 @@ import { NetworkManagerEmittedEvents, } from '../common/NetworkManager.js';

}
async waitForFrame() {
throw new Error('Not implemented');
/**
* Waits for a frame matching the given conditions to appear.
*
* @example
*
* ```ts
* const frame = await page.waitForFrame(async frame => {
* return frame.name() === 'Test';
* });
* ```
*/
async waitForFrame(urlOrPredicate, options = {}) {
const { timeout: ms = this.getDefaultTimeout() } = options;
if (isString(urlOrPredicate)) {
urlOrPredicate = (frame) => {
return urlOrPredicate === frame.url();
};
}
return firstValueFrom(merge(fromEvent(this, "frameattached" /* PageEmittedEvents.FrameAttached */), fromEvent(this, "framenavigated" /* PageEmittedEvents.FrameNavigated */), from(this.frames())).pipe(filterAsync(urlOrPredicate), first(), raceWith(timer(ms === 0 ? Infinity : ms).pipe(map(() => {
throw new TimeoutError(`Timed out after waiting ${ms}ms`);
})), fromEvent(this, "close" /* PageEmittedEvents.Close */).pipe(map(() => {
throw new TargetCloseError('Page closed.');
})))));
}

@@ -623,0 +646,0 @@ async goBack() {

@@ -31,3 +31,7 @@ /**

WEBVIEW = "webview",
OTHER = "other"
OTHER = "other",
/**
* @internal
*/
TAB = "tab"
}

@@ -34,0 +38,0 @@ /**

@@ -28,2 +28,6 @@ /**

TargetType["OTHER"] = "other";
/**
* @internal
*/
TargetType["TAB"] = "tab";
})(TargetType || (TargetType = {}));

@@ -30,0 +34,0 @@ /**

@@ -134,2 +134,6 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void;
/**
* Captures the current state of the accessibility tree.

@@ -136,0 +140,0 @@ * The returned object represents the root accessible node of the page.

@@ -47,2 +47,8 @@ /**

/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
/**
* Captures the current state of the accessibility tree.

@@ -49,0 +55,0 @@ * The returned object represents the root accessible node of the page.

@@ -17,5 +17,3 @@ /**

import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import { AutofillData, ElementHandle as BaseElementHandle, BoundingBox, ClickOptions } from '../../api/ElementHandle.js';
import { KeyPressOptions, KeyboardTypeOptions } from '../../api/Input.js';
import { KeyInput } from '../USKeyboardLayout.js';
import { AutofillData, ElementHandle as BaseElementHandle } from '../../api/ElementHandle.js';
import { Frame } from './Frame.js';

@@ -40,12 +38,4 @@ import { JSHandle } from './JSHandle.js';

autofill(data: AutofillData): Promise<void>;
boundingBox(): Promise<BoundingBox | null>;
click(this: ElementHandle<Element>, options?: Readonly<ClickOptions>): Promise<void>;
hover(this: ElementHandle<Element>): Promise<void>;
tap(this: ElementHandle<Element>): Promise<void>;
touchStart(this: ElementHandle<Element>): Promise<void>;
touchMove(this: ElementHandle<Element>): Promise<void>;
touchEnd(this: ElementHandle<Element>): Promise<void>;
type(text: string, options?: Readonly<KeyboardTypeOptions>): Promise<void>;
press(key: KeyInput, options?: Readonly<KeyPressOptions>): Promise<void>;
contentFrame(this: ElementHandle<HTMLIFrameElement>): Promise<Frame>;
}
//# sourceMappingURL=ElementHandle.d.ts.map

@@ -17,3 +17,3 @@ /**

import { ElementHandle as BaseElementHandle, } from '../../api/ElementHandle.js';
import { assert } from '../../util/assert.js';
import { debugError } from '../util.js';
import { JSHandle } from './JSHandle.js';

@@ -61,93 +61,19 @@ /**

}
async boundingBox() {
if (this.frame.parentFrame()) {
throw new Error('Elements within nested iframes are currently not supported.');
}
const box = await this.frame.isolatedRealm().evaluate(element => {
const rect = element.getBoundingClientRect();
if (!rect.left && !rect.top && !rect.width && !rect.height) {
// TODO(jrandolf): Detect if the element is truly not visible.
return null;
async contentFrame() {
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const handle = (await adoptedThis.evaluateHandle(element => {
if (element instanceof HTMLIFrameElement) {
return element.contentWindow;
}
return {
x: rect.left,
y: rect.top,
width: rect.width,
height: rect.height,
};
}, this);
return box;
}
// ///////////////////
// // Input methods //
// ///////////////////
async click(options) {
await this.scrollIntoViewIfNeeded();
const { x = 0, y = 0 } = options?.offset ?? {};
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().mouse.click(x, y, Object.assign({}, options, {
origin: {
type: 'element',
element: remoteValue,
},
return;
}));
void handle.dispose().catch(debugError);
void adoptedThis.dispose().catch(debugError);
const value = handle.remoteValue();
if (value.type === 'window') {
return this.frame.page().frame(value.value.context);
}
return null;
}
async hover() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().mouse.move(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async tap() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().touchscreen.tap(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async touchStart() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().touchscreen.touchStart(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async touchMove() {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().touchscreen.touchMove(0, 0, {
origin: {
type: 'element',
element: remoteValue,
},
});
}
async touchEnd() {
await this.scrollIntoViewIfNeeded();
await this.#frame.page().touchscreen.touchEnd();
}
async type(text, options) {
await this.focus();
await this.#frame.page().keyboard.type(text, options);
}
async press(key, options) {
await this.focus();
await this.#frame.page().keyboard.press(key, options);
}
}
//# sourceMappingURL=ElementHandle.js.map

@@ -25,3 +25,3 @@ /**

import { Page } from './Page.js';
import { SandboxChart, Sandbox } from './Sandbox.js';
import { Sandbox, SandboxChart } from './Sandbox.js';
/**

@@ -28,0 +28,0 @@ * Puppeteer's Frame class could be viewed as a BiDi BrowsingContext implementation

@@ -408,5 +408,6 @@ /**

async move(x, y, options = {}) {
// https://w3c.github.io/webdriver-bidi/#command-input-performActions:~:text=input.PointerMoveAction%20%3D%20%7B%0A%20%20type%3A%20%22pointerMove%22%2C%0A%20%20x%3A%20js%2Dint%2C
this.#lastMovePoint = {
x,
y,
x: Math.round(x),
y: Math.round(y),
};

@@ -422,4 +423,3 @@ await this.#context.connection.send('input.performActions', {

type: ActionType.PointerMove,
x,
y,
...this.#lastMovePoint,
duration: (options.steps ?? 0) * 50,

@@ -471,4 +471,4 @@ origin: options.origin,

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -559,4 +559,4 @@ },

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -586,4 +586,4 @@ },

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -590,0 +590,0 @@ },

@@ -17,2 +17,3 @@ /**

import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import Protocol from 'devtools-protocol';
import { ElementHandle } from '../../api/ElementHandle.js';

@@ -39,3 +40,4 @@ import { JSHandle as BaseJSHandle } from '../../api/JSHandle.js';

remoteValue(): Bidi.Script.RemoteValue;
remoteObject(): Protocol.Runtime.RemoteObject;
}
//# sourceMappingURL=JSHandle.d.ts.map

@@ -115,3 +115,6 @@ /**

}
remoteObject() {
throw new Error('Not available in WebDriver BiDi');
}
}
//# sourceMappingURL=JSHandle.js.map

@@ -34,3 +34,3 @@ /**

*/
static _create(product: 'firefox' | 'chrome' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean): Promise<CDPBrowser>;
static _create(product: 'firefox' | 'chrome' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean, useTabTarget?: boolean): Promise<CDPBrowser>;
/**

@@ -43,3 +43,3 @@ * @internal

*/
constructor(product: 'chrome' | 'firefox' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean);
constructor(product: 'chrome' | 'firefox' | undefined, connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport | null, process?: ChildProcess, closeCallback?: BrowserCloseCallback, targetFilterCallback?: TargetFilterCallback, isPageTargetCallback?: IsPageTargetCallback, waitForInitiallyDiscoveredTargets?: boolean, useTabTarget?: boolean);
/**

@@ -46,0 +46,0 @@ * @internal

@@ -18,2 +18,3 @@ /**

import { BrowserContext } from '../api/BrowserContext.js';
import { USE_TAB_TARGET } from '../environment.js';
import { assert } from '../util/assert.js';

@@ -32,4 +33,4 @@ import { ChromeTargetManager } from './ChromeTargetManager.js';

*/
static async _create(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true) {
const browser = new CDPBrowser(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets);
static async _create(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true, useTabTarget = USE_TAB_TARGET) {
const browser = new CDPBrowser(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets, useTabTarget);
await browser._attach();

@@ -58,3 +59,3 @@ return browser;

*/
constructor(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true) {
constructor(product, connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback, targetFilterCallback, isPageTargetCallback, waitForInitiallyDiscoveredTargets = true, useTabTarget = USE_TAB_TARGET) {
super();

@@ -78,3 +79,3 @@ product = product || 'chrome';

else {
this.#targetManager = new ChromeTargetManager(connection, this.#createTarget, this.#targetFilterCallback, waitForInitiallyDiscoveredTargets);
this.#targetManager = new ChromeTargetManager(connection, this.#createTarget, this.#targetFilterCallback, waitForInitiallyDiscoveredTargets, useTabTarget);
}

@@ -276,3 +277,5 @@ this.#defaultContext = new CDPBrowserContext(this.#connection, this);

});
const target = this.#targetManager.getAvailableTargets().get(targetId);
const target = (await this.waitForTarget(t => {
return t._targetId === targetId;
}));
if (!target) {

@@ -279,0 +282,0 @@ throw new Error(`Missing target for page (id = ${targetId})`);

@@ -30,3 +30,3 @@ /**

#private;
constructor(connection: Connection, targetFactory: TargetFactory, targetFilterCallback?: TargetFilterCallback, waitForInitiallyDiscoveredTargets?: boolean);
constructor(connection: Connection, targetFactory: TargetFactory, targetFilterCallback?: TargetFilterCallback, waitForInitiallyDiscoveredTargets?: boolean, useTabTarget?: boolean);
initialize(): Promise<void>;

@@ -33,0 +33,0 @@ dispose(): void;

@@ -16,8 +16,15 @@ /**

*/
import { TargetType } from '../api/Target.js';
import { assert } from '../util/assert.js';
import { Deferred } from '../util/Deferred.js';
import { Connection } from './Connection.js';
import { CDPSession, CDPSessionEmittedEvents, Connection } from './Connection.js';
import { EventEmitter } from './EventEmitter.js';
import { InitializationStatus, CDPTarget } from './Target.js';
import { debugError } from './util.js';
function isTargetExposed(target) {
return target.type() !== TargetType.TAB && !target._subtype();
}
function isPageTargetBecomingPrimary(target, newTargetInfo) {
return Boolean(target._subtype()) && !newTargetInfo.subtype;
}
/**

@@ -65,4 +72,11 @@ * ChromeTargetManager uses the CDP's auto-attach mechanism to intercept

#waitForInitiallyDiscoveredTargets = true;
constructor(connection, targetFactory, targetFilterCallback, waitForInitiallyDiscoveredTargets = true) {
// TODO: remove the flag once the testing/rollout is done.
#tabMode;
#discoveryFilter;
constructor(connection, targetFactory, targetFilterCallback, waitForInitiallyDiscoveredTargets = true, useTabTarget = false) {
super();
this.#tabMode = useTabTarget;
this.#discoveryFilter = this.#tabMode
? [{}]
: [{ type: 'tab', exclude: true }, {}];
this.#connection = connection;

@@ -80,3 +94,3 @@ this.#targetFilterCallback = targetFilterCallback;

discover: true,
filter: [{ type: 'tab', exclude: true }, {}],
filter: this.#discoveryFilter,
})

@@ -104,2 +118,11 @@ .then(this.#storeExistingTargetsForInit)

autoAttach: true,
filter: this.#tabMode
? [
{
type: 'page',
exclude: true,
},
...this.#discoveryFilter,
]
: this.#discoveryFilter,
});

@@ -117,3 +140,9 @@ this.#finishInitializationIfReady();

getAvailableTargets() {
return this.#attachedTargetsByTargetId;
const result = new Map();
for (const [id, target] of this.#attachedTargetsByTargetId.entries()) {
if (isTargetExposed(target)) {
result.set(id, target);
}
}
return result;
}

@@ -200,2 +229,8 @@ addTargetInterceptor(session, interceptor) {

const wasInitialized = target._initializedDeferred.value() === InitializationStatus.SUCCESS;
if (isPageTargetBecomingPrimary(target, event.targetInfo)) {
const target = this.#attachedTargetsByTargetId.get(event.targetInfo.targetId);
const session = target?._session();
assert(session, 'Target that is being activated is missing a CDPSession.');
session.parentSession()?.emit(CDPSessionEmittedEvents.Swapped, session);
}
target._targetInfoChanged(event.targetInfo);

@@ -252,3 +287,3 @@ if (wasInitialized && previousURL !== target.url()) {

? this.#attachedTargetsByTargetId.get(targetInfo.targetId)
: this.#targetFactory(targetInfo, session);
: this.#targetFactory(targetInfo, session, parentSession instanceof CDPSession ? parentSession : undefined);
if (this.#targetFilterCallback && !this.#targetFilterCallback(target)) {

@@ -283,3 +318,3 @@ this.#ignoredTargets.add(targetInfo.targetId);

this.#targetsIdsForInit.delete(target._targetId);
if (!existingTarget) {
if (!existingTarget && isTargetExposed(target)) {
this.emit("targetAvailable" /* TargetManagerEmittedEvents.TargetAvailable */, target);

@@ -295,2 +330,3 @@ }

autoAttach: true,
filter: this.#discoveryFilter,
}),

@@ -313,5 +349,7 @@ session.send('Runtime.runIfWaitingForDebugger'),

this.#attachedTargetsByTargetId.delete(target._targetId);
this.emit("targetGone" /* TargetManagerEmittedEvents.TargetGone */, target);
if (isTargetExposed(target)) {
this.emit("targetGone" /* TargetManagerEmittedEvents.TargetGone */, target);
}
};
}
//# sourceMappingURL=ChromeTargetManager.js.map

@@ -22,2 +22,3 @@ /**

import { EventEmitter } from './EventEmitter.js';
import { CDPTarget } from './Target.js';
/**

@@ -132,2 +133,3 @@ * @public

readonly Disconnected: symbol;
readonly Swapped: symbol;
};

@@ -194,2 +196,14 @@ /**

constructor(connection: Connection, targetType: string, sessionId: string, parentSessionId: string | undefined);
/**
* Sets the CDPTarget associated with the session instance.
*
* @internal
*/
_setTarget(target: CDPTarget): void;
/**
* Gets the CDPTarget associated with the session instance.
*
* @internal
*/
_target(): CDPTarget;
connection(): Connection | undefined;

@@ -196,0 +210,0 @@ parentSession(): CDPSession | undefined;

@@ -327,2 +327,3 @@ /**

Disconnected: Symbol('CDPSession.Disconnected'),
Swapped: Symbol('CDPSession.Swapped'),
};

@@ -401,2 +402,3 @@ /**

#parentSessionId;
#target;
/**

@@ -412,2 +414,19 @@ * @internal

}
/**
* Sets the CDPTarget associated with the session instance.
*
* @internal
*/
_setTarget(target) {
this.#target = target;
}
/**
* Gets the CDPTarget associated with the session instance.
*
* @internal
*/
_target() {
assert(this.#target, 'Target must exist');
return this.#target;
}
connection() {

@@ -414,0 +433,0 @@ return this.#connection;

@@ -129,2 +129,6 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void;
/**
* @param options - Set of configurable options for coverage defaults to

@@ -174,2 +178,6 @@ * `resetOnNavigation : true, reportAnonymousScripts : false,`

constructor(client: CDPSession);
/**
* @internal
*/
updateClient(client: CDPSession): void;
start(options?: {

@@ -189,2 +197,6 @@ resetOnNavigation?: boolean;

constructor(client: CDPSession);
/**
* @internal
*/
updateClient(client: CDPSession): void;
start(options?: {

@@ -191,0 +203,0 @@ resetOnNavigation?: boolean;

@@ -63,2 +63,9 @@ /**

/**
* @internal
*/
updateClient(client) {
this.#jsCoverage.updateClient(client);
this.#cssCoverage.updateClient(client);
}
/**
* @param options - Set of configurable options for coverage defaults to

@@ -125,2 +132,8 @@ * `resetOnNavigation : true, reportAnonymousScripts : false,`

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async start(options = {}) {

@@ -226,2 +239,8 @@ assert(!this.#enabled, 'JSCoverage is already enabled');

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async start(options = {}) {

@@ -228,0 +247,0 @@ assert(!this.#enabled, 'CSSCoverage is already enabled');

@@ -18,4 +18,3 @@ /**

import { Protocol } from 'devtools-protocol';
import { AutofillData, BoundingBox, BoxModel, ClickOptions, ElementHandle, Offset, Point } from '../api/ElementHandle.js';
import { KeyPressOptions, KeyboardTypeOptions } from '../api/Input.js';
import { AutofillData, ElementHandle, Point } from '../api/ElementHandle.js';
import { ScreenshotOptions } from '../api/Page.js';

@@ -28,3 +27,2 @@ import { CDPSession } from './Connection.js';

import { NodeFor } from './types.js';
import { KeyInput } from './USKeyboardLayout.js';
/**

@@ -54,18 +52,5 @@ * The CDPElementHandle extends ElementHandle now to keep compatibility

waitForSelector<Selector extends string>(selector: Selector, options?: WaitForSelectorOptions): Promise<CDPElementHandle<NodeFor<Selector>> | null>;
contentFrame(): Promise<Frame | null>;
contentFrame(this: ElementHandle<HTMLIFrameElement>): Promise<Frame>;
scrollIntoView(this: CDPElementHandle<Element>): Promise<void>;
clickablePoint(offset?: Offset): Promise<Point>;
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to hover over the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
hover(this: CDPElementHandle<Element>): Promise<void>;
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to click in the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
click(this: CDPElementHandle<Element>, options?: Readonly<ClickOptions>): Promise<void>;
/**
* This method creates and captures a dragevent from the element.

@@ -81,13 +66,6 @@ */

uploadFile(this: CDPElementHandle<HTMLInputElement>, ...filePaths: string[]): Promise<void>;
tap(this: CDPElementHandle<Element>): Promise<void>;
touchStart(this: CDPElementHandle<Element>): Promise<void>;
touchMove(this: CDPElementHandle<Element>): Promise<void>;
touchEnd(this: CDPElementHandle<Element>): Promise<void>;
type(text: string, options?: Readonly<KeyboardTypeOptions>): Promise<void>;
press(key: KeyInput, options?: Readonly<KeyPressOptions>): Promise<void>;
boundingBox(): Promise<BoundingBox | null>;
boxModel(): Promise<BoxModel | null>;
screenshot(this: CDPElementHandle<Element>, options?: ScreenshotOptions): Promise<string | Buffer>;
autofill(data: AutofillData): Promise<void>;
assertElementHasWorld(): asserts this;
}
//# sourceMappingURL=ElementHandle.d.ts.map

@@ -16,11 +16,6 @@ /**

*/
import { ElementHandle, } from '../api/ElementHandle.js';
import { ElementHandle } from '../api/ElementHandle.js';
import { assert } from '../util/assert.js';
import { CDPJSHandle } from './JSHandle.js';
import { debugError } from './util.js';
const applyOffsetsToQuad = (quad, offsetX, offsetY) => {
return quad.map(part => {
return { x: part.x + offsetX, y: part.y + offsetY };
});
};
/**

@@ -94,139 +89,3 @@ * The CDPElementHandle extends ElementHandle now to keep compatibility

}
async #getOOPIFOffsets(frame) {
let offsetX = 0;
let offsetY = 0;
let currentFrame = frame;
while (currentFrame && currentFrame.parentFrame()) {
const parent = currentFrame.parentFrame();
if (!currentFrame.isOOPFrame() || !parent) {
currentFrame = parent;
continue;
}
const { backendNodeId } = await parent._client().send('DOM.getFrameOwner', {
frameId: currentFrame._id,
});
const result = await parent._client().send('DOM.getBoxModel', {
backendNodeId: backendNodeId,
});
if (!result) {
break;
}
const contentBoxQuad = result.model.content;
const topLeftCorner = this.#fromProtocolQuad(contentBoxQuad)[0];
offsetX += topLeftCorner.x;
offsetY += topLeftCorner.y;
currentFrame = parent;
}
return { offsetX, offsetY };
}
async clickablePoint(offset) {
const [result, layoutMetrics] = await Promise.all([
this.client
.send('DOM.getContentQuads', {
objectId: this.id,
})
.catch(debugError),
this.#page._client().send('Page.getLayoutMetrics'),
]);
if (!result || !result.quads.length) {
throw new Error('Node is either not clickable or not an HTMLElement');
}
// Filter out quads that have too small area to click into.
// Fallback to `layoutViewport` in case of using Firefox.
const { clientWidth, clientHeight } = layoutMetrics.cssLayoutViewport || layoutMetrics.layoutViewport;
const { offsetX, offsetY } = await this.#getOOPIFOffsets(this.#frame);
const quads = result.quads
.map(quad => {
return this.#fromProtocolQuad(quad);
})
.map(quad => {
return applyOffsetsToQuad(quad, offsetX, offsetY);
})
.map(quad => {
return this.#intersectQuadWithViewport(quad, clientWidth, clientHeight);
})
.filter(quad => {
return computeQuadArea(quad) > 1;
});
if (!quads.length) {
throw new Error('Node is either not clickable or not an HTMLElement');
}
const quad = quads[0];
if (offset) {
// Return the point of the first quad identified by offset.
let minX = Number.MAX_SAFE_INTEGER;
let minY = Number.MAX_SAFE_INTEGER;
for (const point of quad) {
if (point.x < minX) {
minX = point.x;
}
if (point.y < minY) {
minY = point.y;
}
}
if (minX !== Number.MAX_SAFE_INTEGER &&
minY !== Number.MAX_SAFE_INTEGER) {
return {
x: minX + offset.x,
y: minY + offset.y,
};
}
}
// Return the middle point of the first quad.
let x = 0;
let y = 0;
for (const point of quad) {
x += point.x;
y += point.y;
}
return {
x: x / 4,
y: y / 4,
};
}
#getBoxModel() {
const params = {
objectId: this.id,
};
return this.client.send('DOM.getBoxModel', params).catch(error => {
return debugError(error);
});
}
#fromProtocolQuad(quad) {
return [
{ x: quad[0], y: quad[1] },
{ x: quad[2], y: quad[3] },
{ x: quad[4], y: quad[5] },
{ x: quad[6], y: quad[7] },
];
}
#intersectQuadWithViewport(quad, width, height) {
return quad.map(point => {
return {
x: Math.min(Math.max(point.x, 0), width),
y: Math.min(Math.max(point.y, 0), height),
};
});
}
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to hover over the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
async hover() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.mouse.move(x, y);
}
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to click in the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
async click(options = {}) {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint(options.offset);
await this.#page.mouse.click(x, y, options);
}
/**
* This method creates and captures a dragevent from the element.

@@ -310,59 +169,2 @@ */

}
async tap() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.touchscreen.touchStart(x, y);
await this.#page.touchscreen.touchEnd();
}
async touchStart() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.touchscreen.touchStart(x, y);
}
async touchMove() {
await this.scrollIntoViewIfNeeded();
const { x, y } = await this.clickablePoint();
await this.#page.touchscreen.touchMove(x, y);
}
async touchEnd() {
await this.scrollIntoViewIfNeeded();
await this.#page.touchscreen.touchEnd();
}
async type(text, options) {
await this.focus();
await this.#page.keyboard.type(text, options);
}
async press(key, options) {
await this.focus();
await this.#page.keyboard.press(key, options);
}
async boundingBox() {
const result = await this.#getBoxModel();
if (!result) {
return null;
}
const { offsetX, offsetY } = await this.#getOOPIFOffsets(this.#frame);
const quad = result.model.border;
const x = Math.min(quad[0], quad[2], quad[4], quad[6]);
const y = Math.min(quad[1], quad[3], quad[5], quad[7]);
const width = Math.max(quad[0], quad[2], quad[4], quad[6]) - x;
const height = Math.max(quad[1], quad[3], quad[5], quad[7]) - y;
return { x: x + offsetX, y: y + offsetY, width, height };
}
async boxModel() {
const result = await this.#getBoxModel();
if (!result) {
return null;
}
const { offsetX, offsetY } = await this.#getOOPIFOffsets(this.#frame);
const { content, padding, border, margin, width, height } = result.model;
return {
content: applyOffsetsToQuad(this.#fromProtocolQuad(content), offsetX, offsetY),
padding: applyOffsetsToQuad(this.#fromProtocolQuad(padding), offsetX, offsetY),
border: applyOffsetsToQuad(this.#fromProtocolQuad(border), offsetX, offsetY),
margin: applyOffsetsToQuad(this.#fromProtocolQuad(margin), offsetX, offsetY),
width,
height,
};
}
async screenshot(options = {}) {

@@ -414,15 +216,6 @@ let needsViewportReset = false;

}
}
function computeQuadArea(quad) {
/* Compute sum of all directed areas of adjacent triangles
https://en.wikipedia.org/wiki/Polygon#Simple_polygons
*/
let area = 0;
for (let i = 0; i < quad.length; ++i) {
const p1 = quad[i];
const p2 = quad[(i + 1) % quad.length];
area += (p1.x * p2.y - p2.x * p1.y) / 2;
assertElementHasWorld() {
assert(this.executionContext()._world);
}
return Math.abs(area);
}
//# sourceMappingURL=ElementHandle.js.map

@@ -26,2 +26,3 @@ /**

constructor(client: CDPSession);
updateClient(client: CDPSession): void;
get javascriptEnabled(): boolean;

@@ -28,0 +29,0 @@ emulateViewport(viewport: Viewport): Promise<boolean>;

@@ -14,2 +14,5 @@ import { assert } from '../util/assert.js';

}
updateClient(client) {
this.#client = client;
}
get javascriptEnabled() {

@@ -16,0 +19,0 @@ return this.#javascriptEnabled;

@@ -73,3 +73,5 @@ /**

const results = ARIAQueryHandler.queryAll(element, selector);
return element.executionContext().evaluateHandle((...elements) => {
return element
.executionContext()
.evaluateHandle((...elements) => {
return elements;

@@ -76,0 +78,0 @@ }, ...(await AsyncIterableUtil.collect(results)));

@@ -40,2 +40,3 @@ /**

FrameDetached: symbol;
FrameSwappedByActivation: symbol;
};

@@ -54,3 +55,8 @@ /**

constructor(frameManager: FrameManager, frameId: string, parentFrameId: string | undefined, client: CDPSession);
updateClient(client: CDPSession): void;
/**
* Updates the frame ID with the new ID. This happens when the main frame is
* replaced by a different frame.
*/
updateId(id: string): void;
updateClient(client: CDPSession, keepWorlds?: boolean): void;
page(): Page;

@@ -57,0 +63,0 @@ isOOPFrame(): boolean;

@@ -36,2 +36,3 @@ /**

FrameDetached: Symbol('Frame.FrameDetached'),
FrameSwappedByActivation: Symbol('Frame.FrameSwappedByActivation'),
};

@@ -60,9 +61,27 @@ /**

this.updateClient(client);
this.on(FrameEmittedEvents.FrameSwappedByActivation, () => {
// Emulate loading process for swapped frames.
this._onLoadingStarted();
this._onLoadingStopped();
});
}
updateClient(client) {
/**
* Updates the frame ID with the new ID. This happens when the main frame is
* replaced by a different frame.
*/
updateId(id) {
this._id = id;
}
updateClient(client, keepWorlds = false) {
this.#client = client;
this.worlds = {
[MAIN_WORLD]: new IsolatedWorld(this),
[PUPPETEER_WORLD]: new IsolatedWorld(this),
};
if (!keepWorlds) {
this.worlds = {
[MAIN_WORLD]: new IsolatedWorld(this),
[PUPPETEER_WORLD]: new IsolatedWorld(this),
};
}
else {
this.worlds[MAIN_WORLD].frameUpdated();
this.worlds[PUPPETEER_WORLD].frameUpdated();
}
}

@@ -69,0 +88,0 @@ page() {

@@ -59,2 +59,8 @@ /**

constructor(client: CDPSession, page: Page, ignoreHTTPSErrors: boolean, timeoutSettings: TimeoutSettings);
/**
* When the main frame is replaced by another main frame,
* we maintain the main frame object identity while updating
* its frame tree and ID.
*/
swapFrameTree(client: CDPSession): Promise<void>;
private setupEventListeners;

@@ -61,0 +67,0 @@ initialize(client?: CDPSession): Promise<void>;

@@ -17,4 +17,5 @@ /**

import { assert } from '../util/assert.js';
import { Deferred } from '../util/Deferred.js';
import { isErrorLike } from '../util/ErrorLike.js';
import { CDPSessionEmittedEvents, isTargetClosedError, } from './Connection.js';
import { CDPSessionEmittedEvents, CDPSessionImpl, isTargetClosedError, } from './Connection.js';
import { DeviceRequestPromptManager } from './DeviceRequestPrompt.js';

@@ -46,2 +47,3 @@ import { EventEmitter } from './EventEmitter.js';

};
const TIME_FOR_WAITING_FOR_SWAP = 100; // ms.
/**

@@ -87,8 +89,61 @@ * A frame manager manages the frames for a given {@link Page | page}.

client.once(CDPSessionEmittedEvents.Disconnected, () => {
const mainFrame = this._frameTree.getMainFrame();
if (mainFrame) {
this.#removeFramesRecursively(mainFrame);
}
this.#onClientDisconnect().catch(debugError);
});
}
/**
* Called when the frame's client is disconnected. We don't know if the
* disconnect means that the frame is removed or if it will be replaced by a
* new frame. Therefore, we wait for a swap event.
*/
async #onClientDisconnect() {
const mainFrame = this._frameTree.getMainFrame();
if (!mainFrame) {
return;
}
for (const child of mainFrame.childFrames()) {
this.#removeFramesRecursively(child);
}
const swapped = Deferred.create({
timeout: TIME_FOR_WAITING_FOR_SWAP,
message: 'Frame was not swapped',
});
mainFrame.once(FrameEmittedEvents.FrameSwappedByActivation, () => {
swapped.resolve();
});
try {
await swapped.valueOrThrow();
}
catch (err) {
this.#removeFramesRecursively(mainFrame);
}
}
/**
* When the main frame is replaced by another main frame,
* we maintain the main frame object identity while updating
* its frame tree and ID.
*/
async swapFrameTree(client) {
this.#onExecutionContextsCleared(this.#client);
this.#client = client;
assert(this.#client instanceof CDPSessionImpl, 'CDPSession is not an instance of CDPSessionImpl.');
const frame = this._frameTree.getMainFrame();
if (frame) {
this.#frameNavigatedReceived.add(this.#client._target()._targetId);
this._frameTree.removeFrame(frame);
frame.updateId(this.#client._target()._targetId);
frame.mainRealm().clearContext();
frame.isolatedRealm().clearContext();
this._frameTree.addFrame(frame);
frame.updateClient(client, true);
}
this.setupEventListeners(client);
client.once(CDPSessionEmittedEvents.Disconnected, () => {
this.#onClientDisconnect().catch(debugError);
});
await this.initialize(client);
await this.#networkManager.updateClient(client);
if (frame) {
frame.emit(FrameEmittedEvents.FrameSwappedByActivation);
}
}
setupEventListeners(session) {

@@ -95,0 +150,0 @@ session.on('Page.frameAttached', event => {

@@ -34,2 +34,6 @@ /**

constructor(client: CDPSession);
/**
* @internal
*/
updateClient(client: CDPSession): void;
down(key: KeyInput, options?: Readonly<KeyDownOptions>): Promise<void>;

@@ -51,2 +55,6 @@ up(key: KeyInput): Promise<void>;

constructor(client: CDPSession, keyboard: CDPKeyboard);
/**
* @internal
*/
updateClient(client: CDPSession): void;
reset(): Promise<void>;

@@ -75,2 +83,6 @@ move(x: number, y: number, options?: Readonly<MouseMoveOptions>): Promise<void>;

constructor(client: CDPSession, keyboard: CDPKeyboard);
/**
* @internal
*/
updateClient(client: CDPSession): void;
tap(x: number, y: number): Promise<void>;

@@ -77,0 +89,0 @@ touchStart(x: number, y: number): Promise<void>;

@@ -36,2 +36,8 @@ /**

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async down(key, options = {

@@ -215,2 +221,8 @@ text: undefined,

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
#_state = {

@@ -447,2 +459,8 @@ position: { x: 0, y: 0 },

}
/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
async tap(x, y) {

@@ -449,0 +467,0 @@ await this.touchStart(x, y);

@@ -82,2 +82,3 @@ /**

constructor(frame: Frame);
frameUpdated(): void;
frame(): Frame;

@@ -84,0 +85,0 @@ clearContext(): void;

@@ -42,5 +42,6 @@ /**

constructor(frame) {
// Keep own reference to client because it might differ from the FrameManager's
// client for OOP iframes.
this.#frame = frame;
this.frameUpdated();
}
frameUpdated() {
this.#client.on('Runtime.bindingCalled', this.#onBindingCalled);

@@ -279,3 +280,10 @@ }

const context = await this.executionContext();
assert(handle.executionContext() !== context, 'Cannot adopt handle that already belongs to this execution context');
if (handle.executionContext() === context) {
// If the context has already adopted this handle, clone it so downstream
// disposal doesn't become an issue.
return (await handle.evaluateHandle(value => {
return value;
// SAFETY: We know the
}));
}
const nodeInfo = await this.#client.send('DOM.describeNode', {

@@ -282,0 +290,0 @@ objectId: handle.id,

@@ -64,2 +64,3 @@ /**

addEventListener(frame, FrameEmittedEvents.FrameSwapped, this.#frameSwapped.bind(this)),
addEventListener(frame, FrameEmittedEvents.FrameSwappedByActivation, this.#frameSwapped.bind(this)),
addEventListener(frame, FrameEmittedEvents.FrameDetached, this.#onFrameDetached.bind(this)),

@@ -66,0 +67,0 @@ addEventListener(networkManager, NetworkManagerEmittedEvents.Request, this.#onRequest.bind(this)),

@@ -60,2 +60,3 @@ /**

constructor(client: CDPSession, ignoreHTTPSErrors: boolean, frameManager: Pick<FrameManager, 'frame'>);
updateClient(client: CDPSession): Promise<void>;
/**

@@ -62,0 +63,0 @@ * Initialize calls should avoid async dependencies between CDP calls as those

@@ -57,2 +57,18 @@ /**

#deferredInit;
#handlers = new Map([
['Fetch.requestPaused', this.#onRequestPaused.bind(this)],
['Fetch.authRequired', this.#onAuthRequired.bind(this)],
['Network.requestWillBeSent', this.#onRequestWillBeSent.bind(this)],
[
'Network.requestServedFromCache',
this.#onRequestServedFromCache.bind(this),
],
['Network.responseReceived', this.#onResponseReceived.bind(this)],
['Network.loadingFinished', this.#onLoadingFinished.bind(this)],
['Network.loadingFailed', this.#onLoadingFailed.bind(this)],
[
'Network.responseReceivedExtraInfo',
this.#onResponseReceivedExtraInfo.bind(this),
],
]);
constructor(client, ignoreHTTPSErrors, frameManager) {

@@ -63,11 +79,14 @@ super();

this.#frameManager = frameManager;
this.#client.on('Fetch.requestPaused', this.#onRequestPaused.bind(this));
this.#client.on('Fetch.authRequired', this.#onAuthRequired.bind(this));
this.#client.on('Network.requestWillBeSent', this.#onRequestWillBeSent.bind(this));
this.#client.on('Network.requestServedFromCache', this.#onRequestServedFromCache.bind(this));
this.#client.on('Network.responseReceived', this.#onResponseReceived.bind(this));
this.#client.on('Network.loadingFinished', this.#onLoadingFinished.bind(this));
this.#client.on('Network.loadingFailed', this.#onLoadingFailed.bind(this));
this.#client.on('Network.responseReceivedExtraInfo', this.#onResponseReceivedExtraInfo.bind(this));
for (const [event, handler] of this.#handlers) {
this.#client.on(event, handler);
}
}
async updateClient(client) {
this.#client = client;
for (const [event, handler] of this.#handlers) {
this.#client.on(event, handler);
}
this.#deferredInit = undefined;
await this.initialize();
}
/**

@@ -74,0 +93,0 @@ * Initialize calls should avoid async dependencies between CDP calls as those

@@ -114,5 +114,2 @@ /**

}): Promise<void>;
waitForFrame(urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>), options?: {
timeout?: number;
}): Promise<Frame>;
goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;

@@ -119,0 +116,0 @@ goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;

@@ -22,3 +22,3 @@ /**

import { Binding } from './Binding.js';
import { CDPSessionEmittedEvents, isTargetClosedError, } from './Connection.js';
import { CDPSessionEmittedEvents, CDPSessionImpl, isTargetClosedError, } from './Connection.js';
import { ConsoleMessage } from './ConsoleMessage.js';

@@ -65,2 +65,3 @@ import { Coverage } from './Coverage.js';

#client;
#tabSession;
#target;

@@ -217,2 +218,3 @@ #keyboard;

this.#client = client;
this.#tabSession = client.parentSession();
this.#target = target;

@@ -230,2 +232,17 @@ this.#keyboard = new CDPKeyboard(client);

this.#setupEventListeners();
this.#tabSession?.on(CDPSessionEmittedEvents.Swapped, async (newSession) => {
this.#client = newSession;
assert(this.#client instanceof CDPSessionImpl, 'CDPSession is not instance of CDPSessionImpl');
this.#target = this.#client._target();
assert(this.#target, 'Missing target on swap');
this.#keyboard.updateClient(newSession);
this.#mouse.updateClient(newSession);
this.#touchscreen.updateClient(newSession);
this.#accessibility.updateClient(newSession);
this.#emulationManager.updateClient(newSession);
this.#tracing.updateClient(newSession);
this.#coverage.updateClient(newSession);
await this.#frameManager.swapFrameTree(newSession);
this.#setupEventListeners();
});
}

@@ -692,31 +709,2 @@ #setupEventListeners() {

}
async waitForFrame(urlOrPredicate, options = {}) {
const { timeout = this.#timeoutSettings.timeout() } = options;
let predicate;
if (isString(urlOrPredicate)) {
predicate = (frame) => {
return Promise.resolve(urlOrPredicate === frame.url());
};
}
else {
predicate = (frame) => {
const value = urlOrPredicate(frame);
if (typeof value === 'boolean') {
return Promise.resolve(value);
}
return value;
};
}
const eventRace = Deferred.race([
waitForEvent(this.#frameManager, FrameManagerEmittedEvents.FrameAttached, predicate, timeout, this.#sessionCloseDeferred.valueOrThrow()),
waitForEvent(this.#frameManager, FrameManagerEmittedEvents.FrameNavigated, predicate, timeout, this.#sessionCloseDeferred.valueOrThrow()),
...this.frames().map(async (frame) => {
if (await predicate(frame)) {
return frame;
}
return await eventRace;
}),
]);
return eventRace;
}
async goBack(options = {}) {

@@ -723,0 +711,0 @@ return this.#go(-1, options);

@@ -60,2 +60,6 @@ /**

*/
_subtype(): string | undefined;
/**
* @internal
*/
_session(): CDPSession | undefined;

@@ -62,0 +66,0 @@ /**

@@ -18,2 +18,3 @@ /**

import { Deferred } from '../util/Deferred.js';
import { CDPSessionImpl } from './Connection.js';
import { CDPPage } from './Page.js';

@@ -64,2 +65,5 @@ import { debugError } from './util.js';

this.#sessionFactory = sessionFactory;
if (this.#session && this.#session instanceof CDPSessionImpl) {
this.#session._setTarget(this);
}
}

@@ -69,2 +73,8 @@ /**

*/
_subtype() {
return this.#targetInfo.subtype;
}
/**
* @internal
*/
_session() {

@@ -86,3 +96,6 @@ return this.#session;

}
return this.#sessionFactory(false);
return this.#sessionFactory(false).then(session => {
session._setTarget(this);
return session;
});
}

@@ -107,2 +120,4 @@ url() {

return TargetType.WEBVIEW;
case 'tab':
return TargetType.TAB;
default:

@@ -109,0 +124,0 @@ return TargetType.OTHER;

@@ -23,3 +23,3 @@ /**

*/
export type TargetFactory = (targetInfo: Protocol.Target.TargetInfo, session?: CDPSession) => CDPTarget;
export type TargetFactory = (targetInfo: Protocol.Target.TargetInfo, session?: CDPSession, parentSession?: CDPSession) => CDPTarget;
/**

@@ -26,0 +26,0 @@ * @internal

@@ -34,2 +34,6 @@ /// <reference types="node" />

/**
* @internal
*/
updateClient(client: CDPSession): void;
/**
* Starts a trace for the current page.

@@ -36,0 +40,0 @@ * @remarks

@@ -47,2 +47,8 @@ /**

/**
* @internal
*/
updateClient(client) {
this.#client = client;
}
/**
* Starts a trace for the current page.

@@ -49,0 +55,0 @@ * @remarks

@@ -28,2 +28,3 @@ /**

import type { ExecutionContext } from './ExecutionContext.js';
import { Awaitable } from './types.js';
/**

@@ -113,3 +114,3 @@ * @internal

*/
export declare function waitForEvent<T>(emitter: CommonEventEmitter, eventName: string | symbol, predicate: (event: T) => Promise<boolean> | boolean, timeout: number, abortPromise: Promise<Error> | Deferred<Error>): Promise<T>;
export declare function waitForEvent<T>(emitter: CommonEventEmitter, eventName: string | symbol, predicate: (event: T) => Awaitable<boolean>, timeout: number, abortPromise: Promise<Error> | Deferred<Error>): Promise<T>;
/**

@@ -116,0 +117,0 @@ * @internal

@@ -24,2 +24,8 @@ /**

export declare const DEFERRED_PROMISE_DEBUG_TIMEOUT: number;
/**
* Only used for internal testing.
*
* @internal
*/
export declare const USE_TAB_TARGET: boolean;
//# sourceMappingURL=environment.d.ts.map

@@ -27,2 +27,10 @@ /**

: -1;
/**
* Only used for internal testing.
*
* @internal
*/
export const USE_TAB_TARGET = typeof process !== 'undefined'
? process.env['PUPPETEER_INTERNAL_TAB_TARGET'] === 'true'
: false;
//# sourceMappingURL=environment.js.map

@@ -8,3 +8,3 @@ /**

*/
export declare const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6+)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6+)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6+)\",\"(?<argument>.+)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
export declare const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6*)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\u00B6*)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6*)\",\"(?<argument>.*)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
//# sourceMappingURL=injected.d.ts.map

@@ -8,3 +8,3 @@ /**

*/
export const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶+)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶+)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6+)\",\"(?<argument>.+)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
export const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶*)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶*)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6*)\",\"(?<argument>.*)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
//# sourceMappingURL=injected.js.map
/**
* @internal
*/
export declare const packageVersion = "21.1.0";
export declare const packageVersion = "21.1.1";
//# sourceMappingURL=version.d.ts.map
/**
* @internal
*/
export const packageVersion = '21.1.0';
export const packageVersion = '21.1.1';
//# sourceMappingURL=version.js.map

@@ -40,3 +40,3 @@ /**

customQuerySelectors: {
"__#158@#selectors": Map<string, CustomQuerySelectors.CustomQuerySelector>;
"__#990@#selectors": Map<string, CustomQuerySelectors.CustomQuerySelector>;
register(name: string, handler: import("../puppeteer-core.js").CustomQueryHandler): void;

@@ -43,0 +43,0 @@ unregister(name: string): void;

@@ -20,2 +20,3 @@ /**

import { debugError } from '../common/util.js';
import { USE_TAB_TARGET } from '../environment.js';
import { assert } from '../util/assert.js';

@@ -131,2 +132,3 @@ import { ProductLauncher } from './ProductLauncher.js';

'--disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints',
...(USE_TAB_TARGET ? [] : ['--disable-features=Prerender2']),
'--disable-hang-monitor',

@@ -133,0 +135,0 @@ '--disable-ipc-flooding-protection',

@@ -17,1 +17,2 @@ /**

export { catchError, defaultIfEmpty, filter, first, ignoreElements, map, mergeMap, raceWith, retry, tap, throwIfEmpty, firstValueFrom, defer, EMPTY, from, fromEvent, merge, race, timer, OperatorFunction, identity, noop, pipe, Observable, } from 'rxjs';
export declare function filterAsync<T>(predicate: (value: T) => boolean | PromiseLike<boolean>): import("rxjs").OperatorFunction<T, T>;

@@ -1,1 +0,1 @@

var n=function(t,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])},n(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(n,t,r,e){return new(r||(r=Promise))((function(o,i){function u(n){try{s(e.next(n))}catch(n){i(n)}}function c(n){try{s(e.throw(n))}catch(n){i(n)}}function s(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(u,c)}s((e=e.apply(n,t||[])).next())}))}function e(n,t){var r,e,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,e=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(n,u)}catch(n){c=[6,n],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(n){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&n[t],e=0;if(r)return r.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&e>=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var e,o,i=r.call(n),u=[];try{for(;(void 0===t||t-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(n){o={error:n}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(n,t,r){if(r||2===arguments.length)for(var e,o=0,i=t.length;o<i;o++)!e&&o in t||(e||(e=Array.prototype.slice.call(t,0,o)),e[o]=t[o]);return n.concat(e||Array.prototype.slice.call(t))}function c(n){return this instanceof c?(this.v=n,this):new c(n)}function s(n,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(n,t||[]),i=[];return e={},u("next"),u("throw"),u("return"),e[Symbol.asyncIterator]=function(){return this},e;function u(n){o[n]&&(e[n]=function(t){return new Promise((function(r,e){i.push([n,t,r,e])>1||s(n,t)}))})}function s(n,t){try{(r=o[n](t)).value instanceof c?Promise.resolve(r.value.v).then(l,a):f(i[0][2],r)}catch(n){f(i[0][3],n)}var r}function l(n){s("next",n)}function a(n){s("throw",n)}function f(n,t){n(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function l(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=n[Symbol.asyncIterator];return r?r.call(n):(n=o(n),t={},e("next"),e("throw"),e("return"),t[Symbol.asyncIterator]=function(){return this},t);function e(r){t[r]=n[r]&&function(t){return new Promise((function(e,o){(function(n,t,r,e){Promise.resolve(e).then((function(t){n({value:t,done:r})}),t)})(e,o,(t=n[r](t)).done,t.value)}))}}}function a(n){return"function"==typeof n}function f(n){var t=n((function(n){Error.call(n),n.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var h=f((function(n){return function(t){n(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(n,t){return t+1+") "+n.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function p(n,t){if(n){var r=n.indexOf(t);0<=r&&n.splice(r,1)}}var v=function(){function n(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return n.prototype.unsubscribe=function(){var n,t,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var l=o(s),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(t){n={error:t}}finally{try{f&&!f.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}else s.remove(this);var p=this.initialTeardown;if(a(p))try{p()}catch(n){c=n instanceof h?n.errors:[n]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var d=o(v),y=d.next();!y.done;y=d.next()){var m=y.value;try{b(m)}catch(n){c=null!=c?c:[],n instanceof h?c=u(u([],i(c)),i(n.errors)):c.push(n)}}}catch(n){r={error:n}}finally{try{y&&!y.done&&(e=d.return)&&e.call(d)}finally{if(r)throw r.error}}}if(c)throw new h(c)}},n.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)b(t);else{if(t instanceof n){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},n.prototype._hasParent=function(n){var t=this._parentage;return t===n||Array.isArray(t)&&t.includes(n)},n.prototype._addParent=function(n){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(n),t):t?[t,n]:n},n.prototype._removeParent=function(n){var t=this._parentage;t===n?this._parentage=null:Array.isArray(t)&&p(t,n)},n.prototype.remove=function(t){var r=this._finalizers;r&&p(r,t),t instanceof n&&t._removeParent(this)},n.EMPTY=((t=new n).closed=!0,t),n}();function d(n){return n instanceof v||n&&"closed"in n&&a(n.remove)&&a(n.add)&&a(n.unsubscribe)}function b(n){a(n)?n():n.unsubscribe()}v.EMPTY;var y={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},m={setTimeout:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=m.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,u([n,t],i(r))):setTimeout.apply(void 0,u([n,t],i(r)))},clearTimeout:function(n){var t=m.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(n)},delegate:void 0};function w(n){m.setTimeout((function(){throw n}))}function x(){}var g=function(n){function r(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,d(t)&&t.add(r)):r.destination=P,r}return t(r,n),r.create=function(n,t,r){return new I(n,t,r)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(v),_=Function.prototype.bind;function S(n,t){return _.call(n,t)}var E=function(){function n(n){this.partialObserver=n}return n.prototype.next=function(n){var t=this.partialObserver;if(t.next)try{t.next(n)}catch(n){A(n)}},n.prototype.error=function(n){var t=this.partialObserver;if(t.error)try{t.error(n)}catch(n){A(n)}else A(n)},n.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){A(n)}},n}(),I=function(n){function r(t,r,e){var o,i,u=n.call(this)||this;a(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:u&&y.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},o={next:t.next&&S(t.next,i),error:t.error&&S(t.error,i),complete:t.complete&&S(t.complete,i)}):o=t;return u.destination=new E(o),u}return t(r,n),r}(g);function A(n){w(n)}var P={closed:!0,next:x,error:function(n){throw n},complete:x},T="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(n){return n}function j(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return k(n)}function k(n){return 0===n.length?O:1===n.length?n[0]:function(t){return n.reduce((function(n,t){return t(n)}),t)}}var z=function(){function n(n){n&&(this._subscribe=n)}return n.prototype.lift=function(t){var r=new n;return r.source=this,r.operator=t,r},n.prototype.subscribe=function(n,t,r){var e,o=this,i=(e=n)&&e instanceof g||function(n){return n&&a(n.next)&&a(n.error)&&a(n.complete)}(e)&&d(e)?n:new I(n,t,r);return function(){var n=o,t=n.operator,r=n.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},n.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(t){n.error(t)}},n.prototype.forEach=function(n,t){var r=this;return new(t=L(t))((function(t,e){var o=new I({next:function(t){try{n(t)}catch(n){e(n),o.unsubscribe()}},error:e,complete:t});r.subscribe(o)}))},n.prototype._subscribe=function(n){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(n)},n.prototype[T]=function(){return this},n.prototype.pipe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return k(n)(this)},n.prototype.toPromise=function(n){var t=this;return new(n=L(n))((function(n,r){var e;t.subscribe((function(n){return e=n}),(function(n){return r(n)}),(function(){return n(e)}))}))},n.create=function(t){return new n(t)},n}();function L(n){var t;return null!==(t=null!=n?n:y.Promise)&&void 0!==t?t:Promise}function U(n){return function(t){if(function(n){return a(null==n?void 0:n.lift)}(t))return t.lift((function(t){try{return n(t,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}function C(n,t,r,e,o){return new D(n,t,r,e,o)}var D=function(n){function r(t,r,e,o,i,u){var c=n.call(this,t)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(n){try{r(n)}catch(n){t.error(n)}}:n.prototype._next,c._error=o?function(n){try{o(n)}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._error,c._complete=e?function(){try{e()}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._complete,c}return t(r,n),r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;n.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},r}(g),N={now:function(){return(N.delegate||Date).now()},delegate:void 0},Y=function(n){function r(t,r){return n.call(this)||this}return t(r,n),r.prototype.schedule=function(n,t){return this},r}(v),q={setInterval:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=q.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,u([n,t],i(r))):setInterval.apply(void 0,u([n,t],i(r)))},clearInterval:function(n){var t=q.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(n)},delegate:void 0},F=function(n){function r(t,r){var e=n.call(this,t,r)||this;return e.scheduler=t,e.work=r,e.pending=!1,e}return t(r,n),r.prototype.schedule=function(n,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=n;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},r.prototype.requestAsyncId=function(n,t,r){return void 0===r&&(r=0),q.setInterval(n.flush.bind(n,this),r)},r.prototype.recycleAsyncId=function(n,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&q.clearInterval(t)},r.prototype.execute=function(n,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(n,t){var r,e=!1;try{this.work(n)}catch(n){e=!0,r=n||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(e,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,n.prototype.unsubscribe.call(this)}},r}(Y),R=function(){function n(t,r){void 0===r&&(r=n.now),this.schedulerActionCtor=t,this.now=r}return n.prototype.schedule=function(n,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,n).schedule(r,t)},n.now=N.now,n}(),M=new(function(n){function r(t,r){void 0===r&&(r=R.now);var e=n.call(this,t,r)||this;return e.actions=[],e._active=!1,e}return t(r,n),r.prototype.flush=function(n){var t=this.actions;if(this._active)t.push(n);else{var r;this._active=!0;do{if(r=n.execute(n.state,n.delay))break}while(n=t.shift());if(this._active=!1,r){for(;n=t.shift();)n.unsubscribe();throw r}}},r}(R))(F),G=new z((function(n){return n.complete()}));function H(n){return n&&a(n.schedule)}function V(n){return n[n.length-1]}var B=function(n){return n&&"number"==typeof n.length&&"function"!=typeof n};function J(n){return a(null==n?void 0:n.then)}function K(n){return a(n[T])}function Q(n){return Symbol.asyncIterator&&a(null==n?void 0:n[Symbol.asyncIterator])}function W(n){return new TypeError("You provided "+(null!==n&&"object"==typeof n?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var X="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Z(n){return a(null==n?void 0:n[X])}function $(n){return s(this,arguments,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:t=n.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(t.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function nn(n){return a(null==n?void 0:n.getReader)}function tn(n){if(n instanceof z)return n;if(null!=n){if(K(n))return i=n,new z((function(n){var t=i[T]();if(a(t.subscribe))return t.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(B(n))return e=n,new z((function(n){for(var t=0;t<e.length&&!n.closed;t++)n.next(e[t]);n.complete()}));if(J(n))return r=n,new z((function(n){r.then((function(t){n.closed||(n.next(t),n.complete())}),(function(t){return n.error(t)})).then(null,w)}));if(Q(n))return rn(n);if(Z(n))return t=n,new z((function(n){var r,e;try{for(var i=o(t),u=i.next();!u.done;u=i.next()){var c=u.value;if(n.next(c),n.closed)return}}catch(n){r={error:n}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}n.complete()}));if(nn(n))return rn($(n))}var t,r,e,i;throw W(n)}function rn(n){return new z((function(t){(function(n,t){var o,i,u,c;return r(this,void 0,void 0,(function(){var r,s;return e(this,(function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=l(n),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,t.next(r),t.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(n,t).catch((function(n){return t.error(n)}))}))}function en(n,t,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=t.schedule((function(){r(),o?n.add(this.schedule(null,e)):this.unsubscribe()}),e);if(n.add(i),!o)return i}function on(n,t){return void 0===t&&(t=0),U((function(r,e){r.subscribe(C(e,(function(r){return en(e,n,(function(){return e.next(r)}),t)}),(function(){return en(e,n,(function(){return e.complete()}),t)}),(function(r){return en(e,n,(function(){return e.error(r)}),t)})))}))}function un(n,t){return void 0===t&&(t=0),U((function(r,e){e.add(n.schedule((function(){return r.subscribe(e)}),t))}))}function cn(n,t){if(!n)throw new Error("Iterable cannot be null");return new z((function(r){en(r,t,(function(){var e=n[Symbol.asyncIterator]();en(r,t,(function(){e.next().then((function(n){n.done?r.complete():r.next(n.value)}))}),0,!0)}))}))}function sn(n,t){if(null!=n){if(K(n))return function(n,t){return tn(n).pipe(un(t),on(t))}(n,t);if(B(n))return function(n,t){return new z((function(r){var e=0;return t.schedule((function(){e===n.length?r.complete():(r.next(n[e++]),r.closed||this.schedule())}))}))}(n,t);if(J(n))return function(n,t){return tn(n).pipe(un(t),on(t))}(n,t);if(Q(n))return cn(n,t);if(Z(n))return function(n,t){return new z((function(r){var e;return en(r,t,(function(){e=n[X](),en(r,t,(function(){var n,t,o;try{t=(n=e.next()).value,o=n.done}catch(n){return void r.error(n)}o?r.complete():r.next(t)}),0,!0)})),function(){return a(null==e?void 0:e.return)&&e.return()}}))}(n,t);if(nn(n))return function(n,t){return cn($(n),t)}(n,t)}throw W(n)}function ln(n,t){return t?sn(n,t):tn(n)}var an=f((function(n){return function(){n(this),this.name="EmptyError",this.message="no elements in sequence"}}));function fn(n,t){var r="object"==typeof t;return new Promise((function(e,o){var i=new I({next:function(n){e(n),i.unsubscribe()},error:o,complete:function(){r?e(t.defaultValue):o(new an)}});n.subscribe(i)}))}function hn(n,t){return U((function(r,e){var o=0;r.subscribe(C(e,(function(r){e.next(n.call(t,r,o++))})))}))}var pn=Array.isArray;function vn(n){return hn((function(t){return function(n,t){return pn(t)?n.apply(void 0,u([],i(t))):n(t)}(n,t)}))}function dn(n,t,r){return void 0===r&&(r=1/0),a(t)?dn((function(r,e){return hn((function(n,o){return t(r,n,e,o)}))(tn(n(r,e)))}),r):("number"==typeof t&&(r=t),U((function(t,e){return function(n,t,r,e,o,i,u,c){var s=[],l=0,a=0,f=!1,h=function(){!f||s.length||l||t.complete()},p=function(n){return l<e?v(n):s.push(n)},v=function(n){i&&t.next(n),l++;var c=!1;tn(r(n,a++)).subscribe(C(t,(function(n){null==o||o(n),i?p(n):t.next(n)}),(function(){c=!0}),void 0,(function(){if(c)try{l--;for(var n=function(){var n=s.shift();u?en(t,u,(function(){return v(n)})):v(n)};s.length&&l<e;)n();h()}catch(n){t.error(n)}})))};return n.subscribe(C(t,p,(function(){f=!0,h()}))),function(){null==c||c()}}(t,e,n,r)})))}function bn(n){return new z((function(t){tn(n()).subscribe(t)}))}var yn=["addListener","removeListener"],mn=["addEventListener","removeEventListener"],wn=["on","off"];function xn(n,t,r,e){if(a(r)&&(e=r,r=void 0),e)return xn(n,t,r).pipe(vn(e));var o=i(function(n){return a(n.addEventListener)&&a(n.removeEventListener)}(n)?mn.map((function(e){return function(o){return n[e](t,o,r)}})):function(n){return a(n.addListener)&&a(n.removeListener)}(n)?yn.map(gn(n,t)):function(n){return a(n.on)&&a(n.off)}(n)?wn.map(gn(n,t)):[],2),u=o[0],c=o[1];if(!u&&B(n))return dn((function(n){return xn(n,t,r)}))(tn(n));if(!u)throw new TypeError("Invalid event target");return new z((function(n){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n.next(1<t.length?t:t[0])};return u(t),function(){return c(t)}}))}function gn(n,t){return function(r){return function(e){return n[r](t,e)}}}function _n(n,t,r){void 0===n&&(n=0),void 0===r&&(r=M);var e=-1;return null!=t&&(H(t)?r=t:e=t),new z((function(t){var o,i=(o=n)instanceof Date&&!isNaN(o)?+n-r.now():n;i<0&&(i=0);var u=0;return r.schedule((function(){t.closed||(t.next(u++),0<=e?this.schedule(void 0,e):t.complete())}),i)}))}function Sn(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var r=function(n){return H(V(n))?n.pop():void 0}(n),e=function(n,t){return"number"==typeof V(n)?n.pop():t}(n,1/0),o=n;return o.length?1===o.length?tn(o[0]):function(n){return void 0===n&&(n=1/0),dn(O,n)}(e)(ln(o,r)):G}var En=Array.isArray;function In(n,t){return U((function(r,e){var o=0;r.subscribe(C(e,(function(r){return n.call(t,r,o++)&&e.next(r)})))}))}function An(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 1===(t=1===(n=t).length&&En(n[0])?n[0]:n).length?tn(t[0]):new z(Pn(t))}function Pn(n){return function(t){for(var r=[],e=function(e){r.push(tn(n[e]).subscribe(C(t,(function(n){if(r){for(var o=0;o<r.length;o++)o!==e&&r[o].unsubscribe();r=null}t.next(n)}))))},o=0;r&&!t.closed&&o<n.length;o++)e(o)}}function Tn(n){return U((function(t,r){var e,o=null,i=!1;o=t.subscribe(C(r,void 0,void 0,(function(u){e=tn(n(u,Tn(n)(t))),o?(o.unsubscribe(),o=null,e.subscribe(r)):i=!0}))),i&&(o.unsubscribe(),o=null,e.subscribe(r))}))}function On(n){return U((function(t,r){var e=!1;t.subscribe(C(r,(function(n){e=!0,r.next(n)}),(function(){e||r.next(n),r.complete()})))}))}function jn(){return U((function(n,t){n.subscribe(C(t,x))}))}function kn(n){return void 0===n&&(n=zn),U((function(t,r){var e=!1;t.subscribe(C(r,(function(n){e=!0,r.next(n)}),(function(){return e?r.complete():r.error(n())})))}))}function zn(){return new an}function Ln(n,t){var r=arguments.length>=2;return function(e){return e.pipe(n?In((function(t,r){return n(t,r,e)})):O,(o=1)<=0?function(){return G}:U((function(n,t){var r=0;n.subscribe(C(t,(function(n){++r<=o&&(t.next(n),o<=r&&t.complete())})))})),r?On(t):kn((function(){return new an})));var o}}function Un(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n.length?U((function(t,r){Pn(u([t],i(n)))(r)})):O}function Cn(n){var t;void 0===n&&(n=1/0);var r=(t=n&&"object"==typeof n?n:{count:n}).count,e=void 0===r?1/0:r,o=t.delay,i=t.resetOnSuccess,u=void 0!==i&&i;return e<=0?O:U((function(n,t){var r,i=0,c=function(){var s=!1;r=n.subscribe(C(t,(function(n){u&&(i=0),t.next(n)}),void 0,(function(n){if(i++<e){var u=function(){r?(r.unsubscribe(),r=null,c()):s=!0};if(null!=o){var l="number"==typeof o?_n(o):tn(o(n,i)),a=C(t,(function(){a.unsubscribe(),u()}),(function(){t.complete()}));l.subscribe(a)}else u()}else t.error(n)}))),s&&(r.unsubscribe(),r=null,c())};c()}))}function Dn(n,t,r){var e=a(n)||t||r?{next:n,error:t,complete:r}:n;return e?U((function(n,t){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;n.subscribe(C(t,(function(n){var r;null===(r=e.next)||void 0===r||r.call(e,n),t.next(n)}),(function(){var n;o=!1,null===(n=e.complete)||void 0===n||n.call(e),t.complete()}),(function(n){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,n),t.error(n)}),(function(){var n,t;o&&(null===(n=e.unsubscribe)||void 0===n||n.call(e)),null===(t=e.finalize)||void 0===t||t.call(e)})))})):O}export{G as EMPTY,z as Observable,Tn as catchError,On as defaultIfEmpty,bn as defer,In as filter,Ln as first,fn as firstValueFrom,ln as from,xn as fromEvent,O as identity,jn as ignoreElements,hn as map,Sn as merge,dn as mergeMap,x as noop,j as pipe,An as race,Un as raceWith,Cn as retry,Dn as tap,kn as throwIfEmpty,_n as timer};
var n=function(t,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])},n(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(n,t,r,e){return new(r||(r=Promise))((function(o,i){function u(n){try{s(e.next(n))}catch(n){i(n)}}function c(n){try{s(e.throw(n))}catch(n){i(n)}}function s(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(u,c)}s((e=e.apply(n,t||[])).next())}))}function e(n,t){var r,e,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,e=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(n,u)}catch(n){c=[6,n],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(n){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&n[t],e=0;if(r)return r.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&e>=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var e,o,i=r.call(n),u=[];try{for(;(void 0===t||t-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(n){o={error:n}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(n,t,r){if(r||2===arguments.length)for(var e,o=0,i=t.length;o<i;o++)!e&&o in t||(e||(e=Array.prototype.slice.call(t,0,o)),e[o]=t[o]);return n.concat(e||Array.prototype.slice.call(t))}function c(n){return this instanceof c?(this.v=n,this):new c(n)}function s(n,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(n,t||[]),i=[];return e={},u("next"),u("throw"),u("return"),e[Symbol.asyncIterator]=function(){return this},e;function u(n){o[n]&&(e[n]=function(t){return new Promise((function(r,e){i.push([n,t,r,e])>1||s(n,t)}))})}function s(n,t){try{(r=o[n](t)).value instanceof c?Promise.resolve(r.value.v).then(l,a):f(i[0][2],r)}catch(n){f(i[0][3],n)}var r}function l(n){s("next",n)}function a(n){s("throw",n)}function f(n,t){n(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function l(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=n[Symbol.asyncIterator];return r?r.call(n):(n=o(n),t={},e("next"),e("throw"),e("return"),t[Symbol.asyncIterator]=function(){return this},t);function e(r){t[r]=n[r]&&function(t){return new Promise((function(e,o){(function(n,t,r,e){Promise.resolve(e).then((function(t){n({value:t,done:r})}),t)})(e,o,(t=n[r](t)).done,t.value)}))}}}function a(n){return"function"==typeof n}function f(n){var t=n((function(n){Error.call(n),n.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var h=f((function(n){return function(t){n(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(n,t){return t+1+") "+n.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function p(n,t){if(n){var r=n.indexOf(t);0<=r&&n.splice(r,1)}}var v=function(){function n(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return n.prototype.unsubscribe=function(){var n,t,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var l=o(s),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(t){n={error:t}}finally{try{f&&!f.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}else s.remove(this);var p=this.initialTeardown;if(a(p))try{p()}catch(n){c=n instanceof h?n.errors:[n]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var d=o(v),y=d.next();!y.done;y=d.next()){var m=y.value;try{b(m)}catch(n){c=null!=c?c:[],n instanceof h?c=u(u([],i(c)),i(n.errors)):c.push(n)}}}catch(n){r={error:n}}finally{try{y&&!y.done&&(e=d.return)&&e.call(d)}finally{if(r)throw r.error}}}if(c)throw new h(c)}},n.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)b(t);else{if(t instanceof n){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},n.prototype._hasParent=function(n){var t=this._parentage;return t===n||Array.isArray(t)&&t.includes(n)},n.prototype._addParent=function(n){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(n),t):t?[t,n]:n},n.prototype._removeParent=function(n){var t=this._parentage;t===n?this._parentage=null:Array.isArray(t)&&p(t,n)},n.prototype.remove=function(t){var r=this._finalizers;r&&p(r,t),t instanceof n&&t._removeParent(this)},n.EMPTY=((t=new n).closed=!0,t),n}();function d(n){return n instanceof v||n&&"closed"in n&&a(n.remove)&&a(n.add)&&a(n.unsubscribe)}function b(n){a(n)?n():n.unsubscribe()}v.EMPTY;var y={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},m={setTimeout:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=m.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,u([n,t],i(r))):setTimeout.apply(void 0,u([n,t],i(r)))},clearTimeout:function(n){var t=m.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(n)},delegate:void 0};function w(n){m.setTimeout((function(){throw n}))}function x(){}var g=function(n){function r(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,d(t)&&t.add(r)):r.destination=P,r}return t(r,n),r.create=function(n,t,r){return new I(n,t,r)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(v),_=Function.prototype.bind;function S(n,t){return _.call(n,t)}var E=function(){function n(n){this.partialObserver=n}return n.prototype.next=function(n){var t=this.partialObserver;if(t.next)try{t.next(n)}catch(n){A(n)}},n.prototype.error=function(n){var t=this.partialObserver;if(t.error)try{t.error(n)}catch(n){A(n)}else A(n)},n.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){A(n)}},n}(),I=function(n){function r(t,r,e){var o,i,u=n.call(this)||this;a(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:u&&y.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},o={next:t.next&&S(t.next,i),error:t.error&&S(t.error,i),complete:t.complete&&S(t.complete,i)}):o=t;return u.destination=new E(o),u}return t(r,n),r}(g);function A(n){w(n)}var P={closed:!0,next:x,error:function(n){throw n},complete:x},T="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(n){return n}function j(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return k(n)}function k(n){return 0===n.length?O:1===n.length?n[0]:function(t){return n.reduce((function(n,t){return t(n)}),t)}}var z=function(){function n(n){n&&(this._subscribe=n)}return n.prototype.lift=function(t){var r=new n;return r.source=this,r.operator=t,r},n.prototype.subscribe=function(n,t,r){var e,o=this,i=(e=n)&&e instanceof g||function(n){return n&&a(n.next)&&a(n.error)&&a(n.complete)}(e)&&d(e)?n:new I(n,t,r);return function(){var n=o,t=n.operator,r=n.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},n.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(t){n.error(t)}},n.prototype.forEach=function(n,t){var r=this;return new(t=L(t))((function(t,e){var o=new I({next:function(t){try{n(t)}catch(n){e(n),o.unsubscribe()}},error:e,complete:t});r.subscribe(o)}))},n.prototype._subscribe=function(n){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(n)},n.prototype[T]=function(){return this},n.prototype.pipe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return k(n)(this)},n.prototype.toPromise=function(n){var t=this;return new(n=L(n))((function(n,r){var e;t.subscribe((function(n){return e=n}),(function(n){return r(n)}),(function(){return n(e)}))}))},n.create=function(t){return new n(t)},n}();function L(n){var t;return null!==(t=null!=n?n:y.Promise)&&void 0!==t?t:Promise}function U(n){return function(t){if(function(n){return a(null==n?void 0:n.lift)}(t))return t.lift((function(t){try{return n(t,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}function C(n,t,r,e,o){return new D(n,t,r,e,o)}var D=function(n){function r(t,r,e,o,i,u){var c=n.call(this,t)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(n){try{r(n)}catch(n){t.error(n)}}:n.prototype._next,c._error=o?function(n){try{o(n)}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._error,c._complete=e?function(){try{e()}catch(n){t.error(n)}finally{this.unsubscribe()}}:n.prototype._complete,c}return t(r,n),r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;n.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},r}(g),N={now:function(){return(N.delegate||Date).now()},delegate:void 0},Y=function(n){function r(t,r){return n.call(this)||this}return t(r,n),r.prototype.schedule=function(n,t){return this},r}(v),q={setInterval:function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var o=q.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,u([n,t],i(r))):setInterval.apply(void 0,u([n,t],i(r)))},clearInterval:function(n){var t=q.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(n)},delegate:void 0},F=function(n){function r(t,r){var e=n.call(this,t,r)||this;return e.scheduler=t,e.work=r,e.pending=!1,e}return t(r,n),r.prototype.schedule=function(n,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=n;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},r.prototype.requestAsyncId=function(n,t,r){return void 0===r&&(r=0),q.setInterval(n.flush.bind(n,this),r)},r.prototype.recycleAsyncId=function(n,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&q.clearInterval(t)},r.prototype.execute=function(n,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(n,t){var r,e=!1;try{this.work(n)}catch(n){e=!0,r=n||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(e,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,n.prototype.unsubscribe.call(this)}},r}(Y),R=function(){function n(t,r){void 0===r&&(r=n.now),this.schedulerActionCtor=t,this.now=r}return n.prototype.schedule=function(n,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,n).schedule(r,t)},n.now=N.now,n}(),M=new(function(n){function r(t,r){void 0===r&&(r=R.now);var e=n.call(this,t,r)||this;return e.actions=[],e._active=!1,e}return t(r,n),r.prototype.flush=function(n){var t=this.actions;if(this._active)t.push(n);else{var r;this._active=!0;do{if(r=n.execute(n.state,n.delay))break}while(n=t.shift());if(this._active=!1,r){for(;n=t.shift();)n.unsubscribe();throw r}}},r}(R))(F),G=new z((function(n){return n.complete()}));function H(n){return n&&a(n.schedule)}function V(n){return n[n.length-1]}var B=function(n){return n&&"number"==typeof n.length&&"function"!=typeof n};function J(n){return a(null==n?void 0:n.then)}function K(n){return a(n[T])}function Q(n){return Symbol.asyncIterator&&a(null==n?void 0:n[Symbol.asyncIterator])}function W(n){return new TypeError("You provided "+(null!==n&&"object"==typeof n?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var X="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Z(n){return a(null==n?void 0:n[X])}function $(n){return s(this,arguments,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:t=n.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(t.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function nn(n){return a(null==n?void 0:n.getReader)}function tn(n){if(n instanceof z)return n;if(null!=n){if(K(n))return i=n,new z((function(n){var t=i[T]();if(a(t.subscribe))return t.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(B(n))return e=n,new z((function(n){for(var t=0;t<e.length&&!n.closed;t++)n.next(e[t]);n.complete()}));if(J(n))return r=n,new z((function(n){r.then((function(t){n.closed||(n.next(t),n.complete())}),(function(t){return n.error(t)})).then(null,w)}));if(Q(n))return rn(n);if(Z(n))return t=n,new z((function(n){var r,e;try{for(var i=o(t),u=i.next();!u.done;u=i.next()){var c=u.value;if(n.next(c),n.closed)return}}catch(n){r={error:n}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}n.complete()}));if(nn(n))return rn($(n))}var t,r,e,i;throw W(n)}function rn(n){return new z((function(t){(function(n,t){var o,i,u,c;return r(this,void 0,void 0,(function(){var r,s;return e(this,(function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=l(n),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,t.next(r),t.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(n,t).catch((function(n){return t.error(n)}))}))}function en(n,t,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=t.schedule((function(){r(),o?n.add(this.schedule(null,e)):this.unsubscribe()}),e);if(n.add(i),!o)return i}function on(n,t){return void 0===t&&(t=0),U((function(r,e){r.subscribe(C(e,(function(r){return en(e,n,(function(){return e.next(r)}),t)}),(function(){return en(e,n,(function(){return e.complete()}),t)}),(function(r){return en(e,n,(function(){return e.error(r)}),t)})))}))}function un(n,t){return void 0===t&&(t=0),U((function(r,e){e.add(n.schedule((function(){return r.subscribe(e)}),t))}))}function cn(n,t){if(!n)throw new Error("Iterable cannot be null");return new z((function(r){en(r,t,(function(){var e=n[Symbol.asyncIterator]();en(r,t,(function(){e.next().then((function(n){n.done?r.complete():r.next(n.value)}))}),0,!0)}))}))}function sn(n,t){if(null!=n){if(K(n))return function(n,t){return tn(n).pipe(un(t),on(t))}(n,t);if(B(n))return function(n,t){return new z((function(r){var e=0;return t.schedule((function(){e===n.length?r.complete():(r.next(n[e++]),r.closed||this.schedule())}))}))}(n,t);if(J(n))return function(n,t){return tn(n).pipe(un(t),on(t))}(n,t);if(Q(n))return cn(n,t);if(Z(n))return function(n,t){return new z((function(r){var e;return en(r,t,(function(){e=n[X](),en(r,t,(function(){var n,t,o;try{t=(n=e.next()).value,o=n.done}catch(n){return void r.error(n)}o?r.complete():r.next(t)}),0,!0)})),function(){return a(null==e?void 0:e.return)&&e.return()}}))}(n,t);if(nn(n))return function(n,t){return cn($(n),t)}(n,t)}throw W(n)}function ln(n,t){return t?sn(n,t):tn(n)}var an=f((function(n){return function(){n(this),this.name="EmptyError",this.message="no elements in sequence"}}));function fn(n,t){var r="object"==typeof t;return new Promise((function(e,o){var i=new I({next:function(n){e(n),i.unsubscribe()},error:o,complete:function(){r?e(t.defaultValue):o(new an)}});n.subscribe(i)}))}function hn(n,t){return U((function(r,e){var o=0;r.subscribe(C(e,(function(r){e.next(n.call(t,r,o++))})))}))}var pn=Array.isArray;function vn(n){return hn((function(t){return function(n,t){return pn(t)?n.apply(void 0,u([],i(t))):n(t)}(n,t)}))}function dn(n,t,r){return void 0===r&&(r=1/0),a(t)?dn((function(r,e){return hn((function(n,o){return t(r,n,e,o)}))(tn(n(r,e)))}),r):("number"==typeof t&&(r=t),U((function(t,e){return function(n,t,r,e,o,i,u,c){var s=[],l=0,a=0,f=!1,h=function(){!f||s.length||l||t.complete()},p=function(n){return l<e?v(n):s.push(n)},v=function(n){i&&t.next(n),l++;var c=!1;tn(r(n,a++)).subscribe(C(t,(function(n){null==o||o(n),i?p(n):t.next(n)}),(function(){c=!0}),void 0,(function(){if(c)try{l--;for(var n=function(){var n=s.shift();u?en(t,u,(function(){return v(n)})):v(n)};s.length&&l<e;)n();h()}catch(n){t.error(n)}})))};return n.subscribe(C(t,p,(function(){f=!0,h()}))),function(){null==c||c()}}(t,e,n,r)})))}function bn(n){return new z((function(t){tn(n()).subscribe(t)}))}var yn=["addListener","removeListener"],mn=["addEventListener","removeEventListener"],wn=["on","off"];function xn(n,t,r,e){if(a(r)&&(e=r,r=void 0),e)return xn(n,t,r).pipe(vn(e));var o=i(function(n){return a(n.addEventListener)&&a(n.removeEventListener)}(n)?mn.map((function(e){return function(o){return n[e](t,o,r)}})):function(n){return a(n.addListener)&&a(n.removeListener)}(n)?yn.map(gn(n,t)):function(n){return a(n.on)&&a(n.off)}(n)?wn.map(gn(n,t)):[],2),u=o[0],c=o[1];if(!u&&B(n))return dn((function(n){return xn(n,t,r)}))(tn(n));if(!u)throw new TypeError("Invalid event target");return new z((function(n){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n.next(1<t.length?t:t[0])};return u(t),function(){return c(t)}}))}function gn(n,t){return function(r){return function(e){return n[r](t,e)}}}function _n(n,t,r){void 0===n&&(n=0),void 0===r&&(r=M);var e=-1;return null!=t&&(H(t)?r=t:e=t),new z((function(t){var o,i=(o=n)instanceof Date&&!isNaN(o)?+n-r.now():n;i<0&&(i=0);var u=0;return r.schedule((function(){t.closed||(t.next(u++),0<=e?this.schedule(void 0,e):t.complete())}),i)}))}function Sn(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var r=function(n){return H(V(n))?n.pop():void 0}(n),e=function(n,t){return"number"==typeof V(n)?n.pop():t}(n,1/0),o=n;return o.length?1===o.length?tn(o[0]):function(n){return void 0===n&&(n=1/0),dn(O,n)}(e)(ln(o,r)):G}var En=Array.isArray;function In(n,t){return U((function(r,e){var o=0;r.subscribe(C(e,(function(r){return n.call(t,r,o++)&&e.next(r)})))}))}function An(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 1===(t=1===(n=t).length&&En(n[0])?n[0]:n).length?tn(t[0]):new z(Pn(t))}function Pn(n){return function(t){for(var r=[],e=function(e){r.push(tn(n[e]).subscribe(C(t,(function(n){if(r){for(var o=0;o<r.length;o++)o!==e&&r[o].unsubscribe();r=null}t.next(n)}))))},o=0;r&&!t.closed&&o<n.length;o++)e(o)}}function Tn(n){return U((function(t,r){var e,o=null,i=!1;o=t.subscribe(C(r,void 0,void 0,(function(u){e=tn(n(u,Tn(n)(t))),o?(o.unsubscribe(),o=null,e.subscribe(r)):i=!0}))),i&&(o.unsubscribe(),o=null,e.subscribe(r))}))}function On(n){return U((function(t,r){var e=!1;t.subscribe(C(r,(function(n){e=!0,r.next(n)}),(function(){e||r.next(n),r.complete()})))}))}function jn(){return U((function(n,t){n.subscribe(C(t,x))}))}function kn(n){return void 0===n&&(n=zn),U((function(t,r){var e=!1;t.subscribe(C(r,(function(n){e=!0,r.next(n)}),(function(){return e?r.complete():r.error(n())})))}))}function zn(){return new an}function Ln(n,t){var r=arguments.length>=2;return function(e){return e.pipe(n?In((function(t,r){return n(t,r,e)})):O,(o=1)<=0?function(){return G}:U((function(n,t){var r=0;n.subscribe(C(t,(function(n){++r<=o&&(t.next(n),o<=r&&t.complete())})))})),r?On(t):kn((function(){return new an})));var o}}function Un(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n.length?U((function(t,r){Pn(u([t],i(n)))(r)})):O}function Cn(n){var t;void 0===n&&(n=1/0);var r=(t=n&&"object"==typeof n?n:{count:n}).count,e=void 0===r?1/0:r,o=t.delay,i=t.resetOnSuccess,u=void 0!==i&&i;return e<=0?O:U((function(n,t){var r,i=0,c=function(){var s=!1;r=n.subscribe(C(t,(function(n){u&&(i=0),t.next(n)}),void 0,(function(n){if(i++<e){var u=function(){r?(r.unsubscribe(),r=null,c()):s=!0};if(null!=o){var l="number"==typeof o?_n(o):tn(o(n,i)),a=C(t,(function(){a.unsubscribe(),u()}),(function(){t.complete()}));l.subscribe(a)}else u()}else t.error(n)}))),s&&(r.unsubscribe(),r=null,c())};c()}))}function Dn(n,t,r){var e=a(n)||t||r?{next:n,error:t,complete:r}:n;return e?U((function(n,t){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;n.subscribe(C(t,(function(n){var r;null===(r=e.next)||void 0===r||r.call(e,n),t.next(n)}),(function(){var n;o=!1,null===(n=e.complete)||void 0===n||n.call(e),t.complete()}),(function(n){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,n),t.error(n)}),(function(){var n,t;o&&(null===(n=e.unsubscribe)||void 0===n||n.call(e)),null===(t=e.finalize)||void 0===t||t.call(e)})))})):O}function Nn(n){return dn((t=>ln(Promise.resolve(n(t))).pipe(In((n=>n)),hn((()=>t)))))}export{G as EMPTY,z as Observable,Tn as catchError,On as defaultIfEmpty,bn as defer,In as filter,Nn as filterAsync,Ln as first,fn as firstValueFrom,ln as from,xn as fromEvent,O as identity,jn as ignoreElements,hn as map,Sn as merge,dn as mergeMap,x as noop,j as pipe,An as race,Un as raceWith,Cn as retry,Dn as tap,kn as throwIfEmpty,_n as timer};
{
"name": "puppeteer-core",
"version": "21.1.0",
"version": "21.1.1",
"description": "A high-level API to control headless Chrome over the DevTools Protocol",

@@ -147,3 +147,3 @@ "keywords": [

"dependencies": {
"chromium-bidi": "0.4.20",
"chromium-bidi": "0.4.22",
"cross-fetch": "4.0.0",

@@ -157,5 +157,5 @@ "debug": "4.3.4",

"rxjs": "7.8.1",
"mitt": "3.0.0",
"parsel-js": "1.1.0"
"mitt": "3.0.1",
"parsel-js": "1.1.2"
}
}

@@ -20,4 +20,2 @@ /**

import {Frame} from '../api/Frame.js';
import {CDPSession} from '../common/Connection.js';
import {ExecutionContext} from '../common/ExecutionContext.js';
import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';

@@ -34,3 +32,7 @@ import {WaitForSelectorOptions} from '../common/IsolatedWorld.js';

import {KeyInput} from '../common/USKeyboardLayout.js';
import {isString, withSourcePuppeteerURLIfNone} from '../common/util.js';
import {
debugError,
isString,
withSourcePuppeteerURLIfNone,
} from '../common/util.js';
import {assert} from '../util/assert.js';

@@ -40,5 +42,5 @@ import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';

import {
KeyboardTypeOptions,
KeyPressOptions,
MouseClickOptions,
KeyboardTypeOptions,
} from './Input.js';

@@ -51,7 +53,12 @@ import {JSHandle} from './JSHandle.js';

*/
export type Quad = [Point, Point, Point, Point];
/**
* @public
*/
export interface BoxModel {
content: Point[];
padding: Point[];
border: Point[];
margin: Point[];
content: Quad;
padding: Quad;
border: Quad;
margin: Quad;
width: number;

@@ -141,3 +148,3 @@ height: number;

export class ElementHandle<
export abstract class ElementHandle<
ElementType extends Node = Element,

@@ -244,2 +251,9 @@ > extends JSHandle<ElementType> {

*/
override remoteObject(): Protocol.Runtime.RemoteObject {
return this.handle.remoteObject();
}
/**
* @internal
*/
override async dispose(): Promise<void> {

@@ -254,20 +268,7 @@ return await this.handle.dispose();

/**
* @internal
* Frame corresponding to the current handle.
*/
override executionContext(): ExecutionContext {
throw new Error('Not implemented');
}
abstract get frame(): Frame;
/**
* @internal
*/
override get client(): CDPSession {
throw new Error('Not implemented');
}
get frame(): Frame {
throw new Error('Not implemented');
}
/**
* Queries the current element for an element matching the given selector.

@@ -609,5 +610,4 @@ *

* // DO NOT DISPOSE `element`, this will be always be the same handle.
* const anchor: ElementHandle<HTMLAnchorElement> = await element.toElement(
* 'a'
* );
* const anchor: ElementHandle<HTMLAnchorElement> =
* await element.toElement('a');
* ```

@@ -632,8 +632,7 @@ *

/**
* Resolves to the content frame for element handles referencing
* iframe nodes, or null otherwise
* Resolves the frame associated with the element, if any. Always exists for
* HTMLIFrameElements.
*/
async contentFrame(): Promise<Frame | null> {
throw new Error('Not implemented');
}
abstract contentFrame(this: ElementHandle<HTMLIFrameElement>): Promise<Frame>;
abstract contentFrame(): Promise<Frame | null>;

@@ -643,5 +642,17 @@ /**

*/
async clickablePoint(offset?: Offset): Promise<Point>;
async clickablePoint(): Promise<Point> {
throw new Error('Not implemented');
async clickablePoint(offset?: Offset): Promise<Point> {
const box = await this.#clickableBox();
if (!box) {
throw new Error('Node is either not clickable or not an Element');
}
if (offset !== undefined) {
return {
x: box.x + offset.x,
y: box.y + offset.y,
};
}
return {
x: box.x + box.width / 2,
y: box.y + box.height / 2,
};
}

@@ -655,3 +666,5 @@

async hover(this: ElementHandle<Element>): Promise<void> {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.frame.page().mouse.move(x, y);
}

@@ -666,6 +679,7 @@

this: ElementHandle<Element>,
options?: ClickOptions
): Promise<void>;
async click(this: ElementHandle<Element>): Promise<void> {
throw new Error('Not implemented');
options: Readonly<ClickOptions> = {}
): Promise<void> {
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint(options.offset);
await this.frame.page().mouse.click(x, y, options);
}

@@ -814,15 +828,23 @@

async tap(this: ElementHandle<Element>): Promise<void> {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.frame.page().touchscreen.touchStart(x, y);
await this.frame.page().touchscreen.touchEnd();
}
async touchStart(this: ElementHandle<Element>): Promise<void> {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.frame.page().touchscreen.touchStart(x, y);
}
async touchMove(this: ElementHandle<Element>): Promise<void> {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.frame.page().touchscreen.touchMove(x, y);
}
async touchEnd(this: ElementHandle<Element>): Promise<void> {
throw new Error('Not implemented');
await this.scrollIntoViewIfNeeded();
await this.frame.page().touchscreen.touchEnd();
}

@@ -870,5 +892,5 @@

options?: Readonly<KeyboardTypeOptions>
): Promise<void>;
async type(): Promise<void> {
throw new Error('Not implemented');
): Promise<void> {
await this.focus();
await this.frame.page().keyboard.type(text, options);
}

@@ -893,7 +915,86 @@

options?: Readonly<KeyPressOptions>
): Promise<void>;
async press(): Promise<void> {
throw new Error('Not implemented');
): Promise<void> {
await this.focus();
await this.frame.page().keyboard.press(key, options);
}
async #clickableBox(): Promise<BoundingBox | null> {
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const boxes = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
return [...element.getClientRects()].map(rect => {
return {x: rect.x, y: rect.y, width: rect.width, height: rect.height};
});
});
void adoptedThis.dispose().catch(debugError);
if (!boxes?.length) {
return null;
}
await this.#intersectBoundingBoxesWithFrame(boxes);
let frame: Frame | null | undefined = this.frame;
let element: HandleFor<HTMLIFrameElement> | null | undefined;
while ((element = await frame?.frameElement())) {
try {
element = await element.frame.isolatedRealm().transferHandle(element);
const parentBox = await element.evaluate(element => {
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
return {
left:
rect.left +
parseInt(style.paddingLeft, 10) +
parseInt(style.borderLeftWidth, 10),
top:
rect.top +
parseInt(style.paddingTop, 10) +
parseInt(style.borderTopWidth, 10),
};
});
if (!parentBox) {
return null;
}
for (const box of boxes) {
box.x += parentBox.left;
box.y += parentBox.top;
}
await element.#intersectBoundingBoxesWithFrame(boxes);
frame = frame?.parentFrame();
} finally {
void element.dispose().catch(debugError);
}
}
const box = boxes.find(box => {
return box.width >= 1 && box.height >= 1;
});
if (!box) {
return null;
}
return {
x: box.x,
y: box.y,
height: box.height,
width: box.width,
};
}
async #intersectBoundingBoxesWithFrame(boxes: BoundingBox[]) {
const {documentWidth, documentHeight} = await this.frame
.isolatedRealm()
.evaluate(() => {
return {
documentWidth: document.documentElement.clientWidth,
documentHeight: document.documentElement.clientHeight,
};
});
for (const box of boxes) {
intersectBoundingBox(box, documentWidth, documentHeight);
}
}
/**

@@ -904,3 +1005,28 @@ * This method returns the bounding box of the element (relative to the main frame),

async boundingBox(): Promise<BoundingBox | null> {
throw new Error('Not implemented');
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const box = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
return {x: rect.x, y: rect.y, width: rect.width, height: rect.height};
});
void adoptedThis.dispose().catch(debugError);
if (!box) {
return null;
}
const offset = await this.#getTopLeftCornerOfFrame();
if (!offset) {
return null;
}
return {
x: box.x + offset.x,
y: box.y + offset.y,
height: box.height,
width: box.width,
};
}

@@ -917,5 +1043,135 @@

async boxModel(): Promise<BoxModel | null> {
throw new Error('Not implemented');
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const model = await adoptedThis.evaluate(element => {
if (!(element instanceof Element)) {
return null;
}
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
const offsets = {
padding: {
left: parseInt(style.paddingLeft, 10),
top: parseInt(style.paddingTop, 10),
right: parseInt(style.paddingRight, 10),
bottom: parseInt(style.paddingBottom, 10),
},
margin: {
left: -parseInt(style.marginLeft, 10),
top: -parseInt(style.marginTop, 10),
right: -parseInt(style.marginRight, 10),
bottom: -parseInt(style.marginBottom, 10),
},
border: {
left: parseInt(style.borderLeft, 10),
top: parseInt(style.borderTop, 10),
right: parseInt(style.borderRight, 10),
bottom: parseInt(style.borderBottom, 10),
},
};
const border: Quad = [
{x: rect.left, y: rect.top},
{x: rect.left + rect.width, y: rect.top},
{x: rect.left + rect.width, y: rect.top + rect.bottom},
{x: rect.left, y: rect.top + rect.bottom},
];
const padding = transformQuadWithOffsets(border, offsets.border);
const content = transformQuadWithOffsets(padding, offsets.padding);
const margin = transformQuadWithOffsets(border, offsets.margin);
return {
content,
padding,
border,
margin,
width: rect.width,
height: rect.height,
};
function transformQuadWithOffsets(
quad: Quad,
offsets: {top: number; left: number; right: number; bottom: number}
): Quad {
return [
{
x: quad[0].x + offsets.left,
y: quad[0].y + offsets.top,
},
{
x: quad[1].x - offsets.right,
y: quad[1].y + offsets.top,
},
{
x: quad[2].x - offsets.right,
y: quad[2].y - offsets.bottom,
},
{
x: quad[3].x + offsets.left,
y: quad[3].y - offsets.bottom,
},
];
}
});
void adoptedThis.dispose().catch(debugError);
if (!model) {
return null;
}
const offset = await this.#getTopLeftCornerOfFrame();
if (!offset) {
return null;
}
for (const attribute of [
'content',
'padding',
'border',
'margin',
] as const) {
for (const point of model[attribute]) {
point.x += offset.x;
point.y += offset.y;
}
}
return model;
}
async #getTopLeftCornerOfFrame() {
const point = {x: 0, y: 0};
let frame: Frame | null | undefined = this.frame;
let element: HandleFor<HTMLIFrameElement> | null | undefined;
while ((element = await frame?.frameElement())) {
try {
element = await element.frame.isolatedRealm().transferHandle(element);
const parentBox = await element.evaluate(element => {
// Element is not visible.
if (element.getClientRects().length === 0) {
return null;
}
const rect = element.getBoundingClientRect();
const style = window.getComputedStyle(element);
return {
left:
rect.left +
parseInt(style.paddingLeft, 10) +
parseInt(style.borderLeftWidth, 10),
top:
rect.top +
parseInt(style.paddingTop, 10) +
parseInt(style.borderTopWidth, 10),
};
});
if (!parentBox) {
return null;
}
point.x += parentBox.left;
point.y += parentBox.top;
frame = frame?.parentFrame();
} finally {
void element.dispose().catch(debugError);
}
}
return point;
}
/**

@@ -1059,5 +1315,3 @@ * This method scrolls element into view if needed, and then uses

*/
assertElementHasWorld(): asserts this {
assert(this.executionContext()._world);
}
abstract assertElementHasWorld(): asserts this;

@@ -1089,6 +1343,3 @@ /**

*/
autofill(data: AutofillData): Promise<void>;
autofill(): Promise<void> {
throw new Error('Not implemented');
}
abstract autofill(data: AutofillData): Promise<void>;
}

@@ -1109,1 +1360,20 @@

}
function intersectBoundingBox(
box: BoundingBox,
width: number,
height: number
): void {
box.width = Math.max(
box.x >= 0
? Math.min(width - box.x, box.width)
: Math.min(width, box.width + box.x),
0
);
box.height = Math.max(
box.y >= 0
? Math.min(height - box.y, box.height)
: Math.min(height, box.height + box.y),
0
);
}

@@ -25,2 +25,3 @@ /**

import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';
import {transposeIterableHandle} from '../common/HandleIterator.js';
import {

@@ -40,3 +41,3 @@ IsolatedWorldChart,

} from '../common/types.js';
import {importFSPromises} from '../common/util.js';
import {debugError, importFSPromises} from '../common/util.js';
import {TaskManager} from '../common/WaitTask.js';

@@ -386,2 +387,23 @@

/**
* @internal
*/
async frameElement(): Promise<HandleFor<HTMLIFrameElement> | null> {
const parentFrame = this.parentFrame();
if (!parentFrame) {
return null;
}
const list = await parentFrame.isolatedRealm().evaluateHandle(() => {
return document.querySelectorAll('iframe');
});
for await (const iframe of transposeIterableHandle(list)) {
const frame = await iframe.contentFrame();
if (frame._id === this._id) {
return iframe;
}
void iframe.dispose().catch(debugError);
}
return null;
}
/**
* Behaves identically to {@link Page.evaluateHandle} except it's run within

@@ -388,0 +410,0 @@ * the context of this frame.

@@ -19,4 +19,2 @@ /**

import {CDPSession} from '../common/Connection.js';
import {ExecutionContext} from '../common/ExecutionContext.js';
import {EvaluateFuncWith, HandleFor, HandleOr} from '../common/types.js';

@@ -47,3 +45,3 @@

*/
export class JSHandle<T = unknown> {
export abstract class JSHandle<T = unknown> {
/**

@@ -67,19 +65,5 @@ * Used for nominally typing {@link JSHandle}.

/**
* @internal
*/
executionContext(): ExecutionContext {
throw new Error('Not implemented');
}
/**
* @internal
*/
get client(): CDPSession {
throw new Error('Not implemented');
}
/**
* Evaluates the given function with the current handle as its first argument.
*/
async evaluate<
abstract evaluate<
Params extends unknown[],

@@ -91,5 +75,2 @@ Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,

): Promise<Awaited<ReturnType<Func>>>;
async evaluate(): Promise<unknown> {
throw new Error('Not implemented');
}

@@ -100,3 +81,3 @@ /**

*/
async evaluateHandle<
abstract evaluateHandle<
Params extends unknown[],

@@ -108,5 +89,2 @@ Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,

): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
async evaluateHandle(): Promise<HandleFor<unknown>> {
throw new Error('Not implemented');
}

@@ -116,12 +94,6 @@ /**

*/
async getProperty<K extends keyof T>(
abstract getProperty<K extends keyof T>(
propertyName: HandleOr<K>
): Promise<HandleFor<T[K]>>;
async getProperty(propertyName: string): Promise<JSHandle<unknown>>;
async getProperty<K extends keyof T>(
propertyName: HandleOr<K>
): Promise<HandleFor<T[K]>>;
async getProperty<K extends keyof T>(): Promise<HandleFor<T[K]>> {
throw new Error('Not implemented');
}
abstract getProperty(propertyName: string): Promise<JSHandle<unknown>>;

@@ -146,5 +118,3 @@ /**

*/
async getProperties(): Promise<Map<string, JSHandle>> {
throw new Error('Not implemented');
}
abstract getProperties(): Promise<Map<string, JSHandle<unknown>>>;

@@ -159,5 +129,3 @@ /**

*/
async jsonValue(): Promise<T> {
throw new Error('Not implemented');
}
abstract jsonValue(): Promise<T>;

@@ -168,5 +136,3 @@ /**

*/
asElement(): ElementHandle<Node> | null {
throw new Error('Not implemented');
}
abstract asElement(): ElementHandle<Node> | null;

@@ -176,5 +142,3 @@ /**

*/
async dispose(): Promise<void> {
throw new Error('Not implemented');
}
abstract dispose(): Promise<void>;

@@ -187,5 +151,3 @@ /**

*/
toString(): string {
throw new Error('Not implemented');
}
abstract toString(): string;

@@ -195,5 +157,3 @@ /**

*/
get id(): string | undefined {
throw new Error('Not implemented');
}
abstract get id(): string | undefined;

@@ -205,5 +165,3 @@ /**

*/
remoteObject(): Protocol.Runtime.RemoteObject {
throw new Error('Not implemented');
}
abstract remoteObject(): Protocol.Runtime.RemoteObject;
}

@@ -445,5 +445,5 @@ /**

return from(handle.click(options)).pipe(
catchError((_, caught) => {
catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
})

@@ -579,5 +579,5 @@ );

.pipe(
catchError((_, caught) => {
catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
})

@@ -608,5 +608,5 @@ );

return from(handle.hover()).pipe(
catchError((_, caught) => {
catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
})

@@ -650,5 +650,5 @@ );

).pipe(
catchError((_, caught) => {
catchError(err => {
void handle.dispose().catch(debugError);
return caught;
throw err;
})

@@ -655,0 +655,0 @@ );

@@ -34,2 +34,6 @@ /**

OTHER = 'other',
/**
* @internal
*/
TAB = 'tab',
}

@@ -36,0 +40,0 @@

@@ -145,2 +145,9 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#client = client;
}
/**
* Captures the current state of the accessibility tree.

@@ -147,0 +154,0 @@ * The returned object represents the root accessible node of the page.

@@ -24,2 +24,3 @@ /**

import {CDPSession} from './Connection.js';
import {CDPJSHandle} from './JSHandle.js';
import {QueryHandler, QuerySelector} from './QueryHandler.js';

@@ -109,3 +110,5 @@ import {AwaitableIterable} from './types.js';

): AwaitableIterable<ElementHandle<Node>> {
const context = element.executionContext();
const context = (
element as unknown as CDPJSHandle<Node>
).executionContext();
const {name, role} = parseARIASelector(selector);

@@ -112,0 +115,0 @@ const results = await queryAXTree(context._client, element, name, role);

@@ -22,11 +22,7 @@ /**

ElementHandle as BaseElementHandle,
BoundingBox,
ClickOptions,
} from '../../api/ElementHandle.js';
import {KeyPressOptions, KeyboardTypeOptions} from '../../api/Input.js';
import {assert} from '../../util/assert.js';
import {KeyInput} from '../USKeyboardLayout.js';
import {debugError} from '../util.js';
import {Frame} from './Frame.js';
import {JSHandle} from './JSHandle.js';
import {JSHandle as BidiJSHandle, JSHandle} from './JSHandle.js';
import {Realm} from './Realm.js';

@@ -71,3 +67,3 @@

*/
override assertElementHasWorld(): asserts this {
assertElementHasWorld(): asserts this {
// TODO: Should assert element has a Sandbox

@@ -91,115 +87,21 @@ return;

override async boundingBox(): Promise<BoundingBox | null> {
if (this.frame.parentFrame()) {
throw new Error(
'Elements within nested iframes are currently not supported.'
);
override async contentFrame(
this: ElementHandle<HTMLIFrameElement>
): Promise<Frame>;
override async contentFrame(): Promise<Frame | null> {
const adoptedThis = await this.frame.isolatedRealm().adoptHandle(this);
const handle = (await adoptedThis.evaluateHandle(element => {
if (element instanceof HTMLIFrameElement) {
return element.contentWindow;
}
return;
})) as BidiJSHandle;
void handle.dispose().catch(debugError);
void adoptedThis.dispose().catch(debugError);
const value = handle.remoteValue();
if (value.type === 'window') {
return this.frame.page().frame(value.value.context);
}
const box = await this.frame.isolatedRealm().evaluate(element => {
const rect = (element as unknown as Element).getBoundingClientRect();
if (!rect.left && !rect.top && !rect.width && !rect.height) {
// TODO(jrandolf): Detect if the element is truly not visible.
return null;
}
return {
x: rect.left,
y: rect.top,
width: rect.width,
height: rect.height,
};
}, this);
return box;
return null;
}
// ///////////////////
// // Input methods //
// ///////////////////
override async click(
this: ElementHandle<Element>,
options?: Readonly<ClickOptions>
): Promise<void> {
await this.scrollIntoViewIfNeeded();
const {x = 0, y = 0} = options?.offset ?? {};
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().mouse.click(
x,
y,
Object.assign({}, options, {
origin: {
type: 'element' as const,
element: remoteValue as Bidi.Script.SharedReference,
},
})
);
}
override async hover(this: ElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().mouse.move(0, 0, {
origin: {
type: 'element' as const,
element: remoteValue as Bidi.Script.SharedReference,
},
});
}
override async tap(this: ElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().touchscreen.tap(0, 0, {
origin: {
type: 'element' as const,
element: remoteValue as Bidi.Script.SharedReference,
},
});
}
override async touchStart(this: ElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().touchscreen.touchStart(0, 0, {
origin: {
type: 'element' as const,
element: remoteValue as Bidi.Script.SharedReference,
},
});
}
override async touchMove(this: ElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const remoteValue = this.remoteValue();
assert('sharedId' in remoteValue);
return this.#frame.page().touchscreen.touchMove(0, 0, {
origin: {
type: 'element' as const,
element: remoteValue as Bidi.Script.SharedReference,
},
});
}
override async touchEnd(this: ElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
await this.#frame.page().touchscreen.touchEnd();
}
override async type(
text: string,
options?: Readonly<KeyboardTypeOptions>
): Promise<void> {
await this.focus();
await this.#frame.page().keyboard.type(text, options);
}
override async press(
key: KeyInput,
options?: Readonly<KeyPressOptions>
): Promise<void> {
await this.focus();
await this.#frame.page().keyboard.press(key, options);
}
}

@@ -39,4 +39,4 @@ /**

PUPPETEER_SANDBOX,
Sandbox,
SandboxChart,
Sandbox,
} from './Sandbox.js';

@@ -43,0 +43,0 @@

@@ -486,5 +486,6 @@ /**

): Promise<void> {
// https://w3c.github.io/webdriver-bidi/#command-input-performActions:~:text=input.PointerMoveAction%20%3D%20%7B%0A%20%20type%3A%20%22pointerMove%22%2C%0A%20%20x%3A%20js%2Dint%2C
this.#lastMovePoint = {
x,
y,
x: Math.round(x),
y: Math.round(y),
};

@@ -500,4 +501,3 @@ await this.#context.connection.send('input.performActions', {

type: ActionType.PointerMove,
x,
y,
...this.#lastMovePoint,
duration: (options.steps ?? 0) * 50,

@@ -556,4 +556,4 @@ origin: options.origin,

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -659,4 +659,4 @@ },

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -691,4 +691,4 @@ },

type: ActionType.PointerMove,
x,
y,
x: Math.round(x),
y: Math.round(y),
origin: options.origin,

@@ -695,0 +695,0 @@ },

@@ -18,2 +18,3 @@ /**

import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import Protocol from 'devtools-protocol';

@@ -171,2 +172,6 @@ import {ElementHandle} from '../../api/ElementHandle.js';

}
override remoteObject(): Protocol.Runtime.RemoteObject {
throw new Error('Not available in WebDriver BiDi');
}
}

@@ -562,5 +562,4 @@ /**

}
const needsReload = await this.#cdpEmulationManager.emulateViewport(
viewport
);
const needsReload =
await this.#cdpEmulationManager.emulateViewport(viewport);
this.#viewport = viewport;

@@ -567,0 +566,0 @@ if (needsReload) {

@@ -35,2 +35,3 @@ /**

import {Target} from '../api/Target.js';
import {USE_TAB_TARGET} from '../environment.js';
import {assert} from '../util/assert.js';

@@ -69,3 +70,4 @@

isPageTargetCallback?: IsPageTargetCallback,
waitForInitiallyDiscoveredTargets = true
waitForInitiallyDiscoveredTargets = true,
useTabTarget = USE_TAB_TARGET
): Promise<CDPBrowser> {

@@ -82,3 +84,4 @@ const browser = new CDPBrowser(

isPageTargetCallback,
waitForInitiallyDiscoveredTargets
waitForInitiallyDiscoveredTargets,
useTabTarget
);

@@ -120,3 +123,4 @@ await browser._attach();

isPageTargetCallback?: IsPageTargetCallback,
waitForInitiallyDiscoveredTargets = true
waitForInitiallyDiscoveredTargets = true,
useTabTarget = USE_TAB_TARGET
) {

@@ -148,3 +152,4 @@ super();

this.#targetFilterCallback,
waitForInitiallyDiscoveredTargets
waitForInitiallyDiscoveredTargets,
useTabTarget
);

@@ -450,3 +455,5 @@ }

});
const target = this.#targetManager.getAvailableTargets().get(targetId);
const target = (await this.waitForTarget(t => {
return (t as CDPTarget)._targetId === targetId;
})) as CDPTarget;
if (!target) {

@@ -453,0 +460,0 @@ throw new Error(`Missing target for page (id = ${targetId})`);

@@ -20,6 +20,7 @@ /**

import {TargetFilterCallback} from '../api/Browser.js';
import {TargetType} from '../api/Target.js';
import {assert} from '../util/assert.js';
import {Deferred} from '../util/Deferred.js';
import {CDPSession, Connection} from './Connection.js';
import {CDPSession, CDPSessionEmittedEvents, Connection} from './Connection.js';
import {EventEmitter} from './EventEmitter.js';

@@ -35,2 +36,13 @@ import {InitializationStatus, CDPTarget} from './Target.js';

function isTargetExposed(target: CDPTarget): boolean {
return target.type() !== TargetType.TAB && !target._subtype();
}
function isPageTargetBecomingPrimary(
target: CDPTarget,
newTargetInfo: Protocol.Target.TargetInfo
): boolean {
return Boolean(target._subtype()) && !newTargetInfo.subtype;
}
/**

@@ -91,2 +103,6 @@ * ChromeTargetManager uses the CDP's auto-attach mechanism to intercept

// TODO: remove the flag once the testing/rollout is done.
#tabMode: boolean;
#discoveryFilter: Protocol.Target.FilterEntry[];
constructor(

@@ -96,5 +112,10 @@ connection: Connection,

targetFilterCallback?: TargetFilterCallback,
waitForInitiallyDiscoveredTargets = true
waitForInitiallyDiscoveredTargets = true,
useTabTarget = false
) {
super();
this.#tabMode = useTabTarget;
this.#discoveryFilter = this.#tabMode
? [{}]
: [{type: 'tab', exclude: true}, {}];
this.#connection = connection;

@@ -114,3 +135,3 @@ this.#targetFilterCallback = targetFilterCallback;

discover: true,
filter: [{type: 'tab', exclude: true}, {}],
filter: this.#discoveryFilter,
})

@@ -151,2 +172,11 @@ .then(this.#storeExistingTargetsForInit)

autoAttach: true,
filter: this.#tabMode
? [
{
type: 'page',
exclude: true,
},
...this.#discoveryFilter,
]
: this.#discoveryFilter,
});

@@ -167,3 +197,9 @@ this.#finishInitializationIfReady();

getAvailableTargets(): Map<string, CDPTarget> {
return this.#attachedTargetsByTargetId;
const result = new Map<string, CDPTarget>();
for (const [id, target] of this.#attachedTargetsByTargetId.entries()) {
if (isTargetExposed(target)) {
result.set(id, target);
}
}
return result;
}

@@ -295,2 +331,14 @@

if (isPageTargetBecomingPrimary(target, event.targetInfo)) {
const target = this.#attachedTargetsByTargetId.get(
event.targetInfo.targetId
);
const session = target?._session();
assert(
session,
'Target that is being activated is missing a CDPSession.'
);
session.parentSession()?.emit(CDPSessionEmittedEvents.Swapped, session);
}
target._targetInfoChanged(event.targetInfo);

@@ -361,3 +409,7 @@

? this.#attachedTargetsByTargetId.get(targetInfo.targetId)!
: this.#targetFactory(targetInfo, session);
: this.#targetFactory(
targetInfo,
session,
parentSession instanceof CDPSession ? parentSession : undefined
);

@@ -403,3 +455,3 @@ if (this.#targetFilterCallback && !this.#targetFilterCallback(target)) {

this.#targetsIdsForInit.delete(target._targetId);
if (!existingTarget) {
if (!existingTarget && isTargetExposed(target)) {
this.emit(TargetManagerEmittedEvents.TargetAvailable, target);

@@ -416,2 +468,3 @@ }

autoAttach: true,
filter: this.#discoveryFilter,
}),

@@ -442,4 +495,6 @@ session.send('Runtime.runIfWaitingForDebugger'),

this.#attachedTargetsByTargetId.delete(target._targetId);
this.emit(TargetManagerEmittedEvents.TargetGone, target);
if (isTargetExposed(target)) {
this.emit(TargetManagerEmittedEvents.TargetGone, target);
}
};
}

@@ -27,2 +27,3 @@ /**

import {EventEmitter} from './EventEmitter.js';
import {CDPTarget} from './Target.js';
import {debugError} from './util.js';

@@ -433,2 +434,3 @@

Disconnected: Symbol('CDPSession.Disconnected'),
Swapped: Symbol('CDPSession.Swapped'),
} as const;

@@ -520,2 +522,3 @@

#parentSessionId?: string;
#target?: CDPTarget;

@@ -538,2 +541,21 @@ /**

/**
* Sets the CDPTarget associated with the session instance.
*
* @internal
*/
_setTarget(target: CDPTarget): void {
this.#target = target;
}
/**
* Gets the CDPTarget associated with the session instance.
*
* @internal
*/
_target(): CDPTarget {
assert(this.#target, 'Target must exist');
return this.#target;
}
override connection(): Connection | undefined {

@@ -540,0 +562,0 @@ return this.#connection;

@@ -148,2 +148,10 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#jsCoverage.updateClient(client);
this.#cssCoverage.updateClient(client);
}
/**
* @param options - Set of configurable options for coverage defaults to

@@ -216,2 +224,9 @@ * `resetOnNavigation : true, reportAnonymousScripts : false,`

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#client = client;
}
async start(

@@ -347,2 +362,9 @@ options: {

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#client = client;
}
async start(options: {resetOnNavigation?: boolean} = {}): Promise<void> {

@@ -349,0 +371,0 @@ assert(!this.#enabled, 'CSSCoverage is already enabled');

@@ -19,12 +19,3 @@ /**

import {
AutofillData,
BoundingBox,
BoxModel,
ClickOptions,
ElementHandle,
Offset,
Point,
} from '../api/ElementHandle.js';
import {KeyPressOptions, KeyboardTypeOptions} from '../api/Input.js';
import {AutofillData, ElementHandle, Point} from '../api/ElementHandle.js';
import {Page, ScreenshotOptions} from '../api/Page.js';

@@ -39,17 +30,5 @@ import {assert} from '../util/assert.js';

import {CDPJSHandle} from './JSHandle.js';
import {CDPPage} from './Page.js';
import {NodeFor} from './types.js';
import {KeyInput} from './USKeyboardLayout.js';
import {debugError} from './util.js';
const applyOffsetsToQuad = (
quad: Point[],
offsetX: number,
offsetY: number
) => {
return quad.map(part => {
return {x: part.x + offsetX, y: part.y + offsetY};
});
};
/**

@@ -80,3 +59,3 @@ * The CDPElementHandle extends ElementHandle now to keep compatibility

*/
override executionContext(): ExecutionContext {
executionContext(): ExecutionContext {
return this.handle.executionContext();

@@ -88,3 +67,3 @@ }

*/
override get client(): CDPSession {
get client(): CDPSession {
return this.handle.client;

@@ -134,2 +113,5 @@ }

override async contentFrame(
this: ElementHandle<HTMLIFrameElement>
): Promise<Frame>;
override async contentFrame(): Promise<Frame | null> {

@@ -160,158 +142,3 @@ const nodeInfo = await this.client.send('DOM.describeNode', {

async #getOOPIFOffsets(
frame: Frame
): Promise<{offsetX: number; offsetY: number}> {
let offsetX = 0;
let offsetY = 0;
let currentFrame: Frame | null = frame;
while (currentFrame && currentFrame.parentFrame()) {
const parent = currentFrame.parentFrame();
if (!currentFrame.isOOPFrame() || !parent) {
currentFrame = parent;
continue;
}
const {backendNodeId} = await parent._client().send('DOM.getFrameOwner', {
frameId: currentFrame._id,
});
const result = await parent._client().send('DOM.getBoxModel', {
backendNodeId: backendNodeId,
});
if (!result) {
break;
}
const contentBoxQuad = result.model.content;
const topLeftCorner = this.#fromProtocolQuad(contentBoxQuad)[0];
offsetX += topLeftCorner!.x;
offsetY += topLeftCorner!.y;
currentFrame = parent;
}
return {offsetX, offsetY};
}
override async clickablePoint(offset?: Offset): Promise<Point> {
const [result, layoutMetrics] = await Promise.all([
this.client
.send('DOM.getContentQuads', {
objectId: this.id,
})
.catch(debugError),
(this.#page as CDPPage)._client().send('Page.getLayoutMetrics'),
]);
if (!result || !result.quads.length) {
throw new Error('Node is either not clickable or not an HTMLElement');
}
// Filter out quads that have too small area to click into.
// Fallback to `layoutViewport` in case of using Firefox.
const {clientWidth, clientHeight} =
layoutMetrics.cssLayoutViewport || layoutMetrics.layoutViewport;
const {offsetX, offsetY} = await this.#getOOPIFOffsets(this.#frame);
const quads = result.quads
.map(quad => {
return this.#fromProtocolQuad(quad);
})
.map(quad => {
return applyOffsetsToQuad(quad, offsetX, offsetY);
})
.map(quad => {
return this.#intersectQuadWithViewport(quad, clientWidth, clientHeight);
})
.filter(quad => {
return computeQuadArea(quad) > 1;
});
if (!quads.length) {
throw new Error('Node is either not clickable or not an HTMLElement');
}
const quad = quads[0]!;
if (offset) {
// Return the point of the first quad identified by offset.
let minX = Number.MAX_SAFE_INTEGER;
let minY = Number.MAX_SAFE_INTEGER;
for (const point of quad) {
if (point.x < minX) {
minX = point.x;
}
if (point.y < minY) {
minY = point.y;
}
}
if (
minX !== Number.MAX_SAFE_INTEGER &&
minY !== Number.MAX_SAFE_INTEGER
) {
return {
x: minX + offset.x,
y: minY + offset.y,
};
}
}
// Return the middle point of the first quad.
let x = 0;
let y = 0;
for (const point of quad) {
x += point.x;
y += point.y;
}
return {
x: x / 4,
y: y / 4,
};
}
#getBoxModel(): Promise<void | Protocol.DOM.GetBoxModelResponse> {
const params: Protocol.DOM.GetBoxModelRequest = {
objectId: this.id,
};
return this.client.send('DOM.getBoxModel', params).catch(error => {
return debugError(error);
});
}
#fromProtocolQuad(quad: number[]): Point[] {
return [
{x: quad[0]!, y: quad[1]!},
{x: quad[2]!, y: quad[3]!},
{x: quad[4]!, y: quad[5]!},
{x: quad[6]!, y: quad[7]!},
];
}
#intersectQuadWithViewport(
quad: Point[],
width: number,
height: number
): Point[] {
return quad.map(point => {
return {
x: Math.min(Math.max(point.x, 0), width),
y: Math.min(Math.max(point.y, 0), height),
};
});
}
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to hover over the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
override async hover(this: CDPElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.#page.mouse.move(x, y);
}
/**
* This method scrolls element into view if needed, and then
* uses {@link Page.mouse} to click in the center of the element.
* If the element is detached from DOM, the method throws an error.
*/
override async click(
this: CDPElementHandle<Element>,
options: Readonly<ClickOptions> = {}
): Promise<void> {
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint(options.offset);
await this.#page.mouse.click(x, y, options);
}
/**
* This method creates and captures a dragevent from the element.

@@ -431,95 +258,2 @@ */

override async tap(this: CDPElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.#page.touchscreen.touchStart(x, y);
await this.#page.touchscreen.touchEnd();
}
override async touchStart(this: CDPElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.#page.touchscreen.touchStart(x, y);
}
override async touchMove(this: CDPElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
const {x, y} = await this.clickablePoint();
await this.#page.touchscreen.touchMove(x, y);
}
override async touchEnd(this: CDPElementHandle<Element>): Promise<void> {
await this.scrollIntoViewIfNeeded();
await this.#page.touchscreen.touchEnd();
}
override async type(
text: string,
options?: Readonly<KeyboardTypeOptions>
): Promise<void> {
await this.focus();
await this.#page.keyboard.type(text, options);
}
override async press(
key: KeyInput,
options?: Readonly<KeyPressOptions>
): Promise<void> {
await this.focus();
await this.#page.keyboard.press(key, options);
}
override async boundingBox(): Promise<BoundingBox | null> {
const result = await this.#getBoxModel();
if (!result) {
return null;
}
const {offsetX, offsetY} = await this.#getOOPIFOffsets(this.#frame);
const quad = result.model.border;
const x = Math.min(quad[0]!, quad[2]!, quad[4]!, quad[6]!);
const y = Math.min(quad[1]!, quad[3]!, quad[5]!, quad[7]!);
const width = Math.max(quad[0]!, quad[2]!, quad[4]!, quad[6]!) - x;
const height = Math.max(quad[1]!, quad[3]!, quad[5]!, quad[7]!) - y;
return {x: x + offsetX, y: y + offsetY, width, height};
}
override async boxModel(): Promise<BoxModel | null> {
const result = await this.#getBoxModel();
if (!result) {
return null;
}
const {offsetX, offsetY} = await this.#getOOPIFOffsets(this.#frame);
const {content, padding, border, margin, width, height} = result.model;
return {
content: applyOffsetsToQuad(
this.#fromProtocolQuad(content),
offsetX,
offsetY
),
padding: applyOffsetsToQuad(
this.#fromProtocolQuad(padding),
offsetX,
offsetY
),
border: applyOffsetsToQuad(
this.#fromProtocolQuad(border),
offsetX,
offsetY
),
margin: applyOffsetsToQuad(
this.#fromProtocolQuad(margin),
offsetX,
offsetY
),
width,
height,
};
}
override async screenshot(

@@ -595,15 +329,6 @@ this: CDPElementHandle<Element>,

}
}
function computeQuadArea(quad: Point[]): number {
/* Compute sum of all directed areas of adjacent triangles
https://en.wikipedia.org/wiki/Polygon#Simple_polygons
*/
let area = 0;
for (let i = 0; i < quad.length; ++i) {
const p1 = quad[i]!;
const p2 = quad[(i + 1) % quad.length]!;
area += (p1.x * p2.y - p2.x * p1.y) / 2;
override assertElementHasWorld(): asserts this {
assert(this.executionContext()._world);
}
return Math.abs(area);
}

@@ -38,2 +38,6 @@ /**

updateClient(client: CDPSession): void {
this.#client = client;
}
get javascriptEnabled(): boolean {

@@ -40,0 +44,0 @@ return this.#javascriptEnabled;

@@ -108,8 +108,10 @@ /**

const results = ARIAQueryHandler.queryAll(element, selector);
return element.executionContext().evaluateHandle(
(...elements) => {
return elements;
},
...(await AsyncIterableUtil.collect(results))
);
return (element as unknown as CDPJSHandle<Node>)
.executionContext()
.evaluateHandle(
(...elements) => {
return elements;
},
...(await AsyncIterableUtil.collect(results))
);
}) as (...args: unknown[]) => unknown)

@@ -116,0 +118,0 @@ ),

@@ -52,2 +52,3 @@ /**

FrameDetached: Symbol('Frame.FrameDetached'),
FrameSwappedByActivation: Symbol('Frame.FrameSwappedByActivation'),
};

@@ -86,10 +87,29 @@

this.updateClient(client);
this.on(FrameEmittedEvents.FrameSwappedByActivation, () => {
// Emulate loading process for swapped frames.
this._onLoadingStarted();
this._onLoadingStopped();
});
}
updateClient(client: CDPSession): void {
/**
* Updates the frame ID with the new ID. This happens when the main frame is
* replaced by a different frame.
*/
updateId(id: string): void {
this._id = id;
}
updateClient(client: CDPSession, keepWorlds = false): void {
this.#client = client;
this.worlds = {
[MAIN_WORLD]: new IsolatedWorld(this),
[PUPPETEER_WORLD]: new IsolatedWorld(this),
};
if (!keepWorlds) {
this.worlds = {
[MAIN_WORLD]: new IsolatedWorld(this),
[PUPPETEER_WORLD]: new IsolatedWorld(this),
};
} else {
this.worlds[MAIN_WORLD].frameUpdated();
this.worlds[PUPPETEER_WORLD].frameUpdated();
}
}

@@ -96,0 +116,0 @@

@@ -21,2 +21,3 @@ /**

import {assert} from '../util/assert.js';
import {Deferred} from '../util/Deferred.js';
import {isErrorLike} from '../util/ErrorLike.js';

@@ -27,2 +28,3 @@

CDPSessionEmittedEvents,
CDPSessionImpl,
isTargetClosedError,

@@ -64,2 +66,4 @@ } from './Connection.js';

const TIME_FOR_WAITING_FOR_SWAP = 100; // ms.
/**

@@ -119,9 +123,67 @@ * A frame manager manages the frames for a given {@link Page | page}.

client.once(CDPSessionEmittedEvents.Disconnected, () => {
const mainFrame = this._frameTree.getMainFrame();
if (mainFrame) {
this.#removeFramesRecursively(mainFrame);
}
this.#onClientDisconnect().catch(debugError);
});
}
/**
* Called when the frame's client is disconnected. We don't know if the
* disconnect means that the frame is removed or if it will be replaced by a
* new frame. Therefore, we wait for a swap event.
*/
async #onClientDisconnect() {
const mainFrame = this._frameTree.getMainFrame();
if (!mainFrame) {
return;
}
for (const child of mainFrame.childFrames()) {
this.#removeFramesRecursively(child);
}
const swapped = Deferred.create<void>({
timeout: TIME_FOR_WAITING_FOR_SWAP,
message: 'Frame was not swapped',
});
mainFrame.once(FrameEmittedEvents.FrameSwappedByActivation, () => {
swapped.resolve();
});
try {
await swapped.valueOrThrow();
} catch (err) {
this.#removeFramesRecursively(mainFrame);
}
}
/**
* When the main frame is replaced by another main frame,
* we maintain the main frame object identity while updating
* its frame tree and ID.
*/
async swapFrameTree(client: CDPSession): Promise<void> {
this.#onExecutionContextsCleared(this.#client);
this.#client = client;
assert(
this.#client instanceof CDPSessionImpl,
'CDPSession is not an instance of CDPSessionImpl.'
);
const frame = this._frameTree.getMainFrame();
if (frame) {
this.#frameNavigatedReceived.add(this.#client._target()._targetId);
this._frameTree.removeFrame(frame);
frame.updateId(this.#client._target()._targetId);
frame.mainRealm().clearContext();
frame.isolatedRealm().clearContext();
this._frameTree.addFrame(frame);
frame.updateClient(client, true);
}
this.setupEventListeners(client);
client.once(CDPSessionEmittedEvents.Disconnected, () => {
this.#onClientDisconnect().catch(debugError);
});
await this.initialize(client);
await this.#networkManager.updateClient(client);
if (frame) {
frame.emit(FrameEmittedEvents.FrameSwappedByActivation);
}
}
private setupEventListeners(session: CDPSession) {

@@ -128,0 +190,0 @@ session.on('Page.frameAttached', event => {

@@ -62,2 +62,9 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#client = client;
}
override async down(

@@ -294,2 +301,9 @@ key: KeyInput,

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#client = client;
}
#_state: Readonly<MouseState> = {

@@ -576,2 +590,9 @@ position: {x: 0, y: 0},

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#client = client;
}
override async tap(x: number, y: number): Promise<void> {

@@ -578,0 +599,0 @@ await this.touchStart(x, y);

@@ -32,2 +32,3 @@ /**

import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
import {CDPJSHandle} from './JSHandle.js';
import {LifecycleWatcher, PuppeteerLifeCycleEvent} from './LifecycleWatcher.js';

@@ -127,5 +128,7 @@ import {TimeoutSettings} from './TimeoutSettings.js';

constructor(frame: Frame) {
// Keep own reference to client because it might differ from the FrameManager's
// client for OOP iframes.
this.#frame = frame;
this.frameUpdated();
}
frameUpdated(): void {
this.#client.on('Runtime.bindingCalled', this.#onBindingCalled);

@@ -504,6 +507,12 @@ }

const context = await this.executionContext();
assert(
handle.executionContext() !== context,
'Cannot adopt handle that already belongs to this execution context'
);
if (
(handle as unknown as CDPJSHandle<Node>).executionContext() === context
) {
// If the context has already adopted this handle, clone it so downstream
// disposal doesn't become an issue.
return (await handle.evaluateHandle(value => {
return value;
// SAFETY: We know the
})) as unknown as T;
}
const nodeInfo = await this.#client.send('DOM.describeNode', {

@@ -517,3 +526,5 @@ objectId: handle.id,

const context = await this.executionContext();
if (handle.executionContext() === context) {
if (
(handle as unknown as CDPJSHandle<Node>).executionContext() === context
) {
return handle;

@@ -520,0 +531,0 @@ }

@@ -54,7 +54,7 @@ /**

override executionContext(): ExecutionContext {
executionContext(): ExecutionContext {
return this.#context;
}
override get client(): CDPSession {
get client(): CDPSession {
return this.#context._client;

@@ -61,0 +61,0 @@ }

@@ -122,2 +122,7 @@ /**

frame,
FrameEmittedEvents.FrameSwappedByActivation,
this.#frameSwapped.bind(this)
),
addEventListener(
frame,
FrameEmittedEvents.FrameDetached,

@@ -124,0 +129,0 @@ this.#onFrameDetached.bind(this)

@@ -24,3 +24,3 @@ /**

import {CDPSession} from './Connection.js';
import {EventEmitter} from './EventEmitter.js';
import {EventEmitter, Handler} from './EventEmitter.js';
import {FrameManager} from './FrameManager.js';

@@ -94,2 +94,19 @@ import {HTTPRequest} from './HTTPRequest.js';

#handlers = new Map<string, Handler<any>>([
['Fetch.requestPaused', this.#onRequestPaused.bind(this)],
['Fetch.authRequired', this.#onAuthRequired.bind(this)],
['Network.requestWillBeSent', this.#onRequestWillBeSent.bind(this)],
[
'Network.requestServedFromCache',
this.#onRequestServedFromCache.bind(this),
],
['Network.responseReceived', this.#onResponseReceived.bind(this)],
['Network.loadingFinished', this.#onLoadingFinished.bind(this)],
['Network.loadingFailed', this.#onLoadingFailed.bind(this)],
[
'Network.responseReceivedExtraInfo',
this.#onResponseReceivedExtraInfo.bind(this),
],
]);
constructor(

@@ -105,27 +122,16 @@ client: CDPSession,

this.#client.on('Fetch.requestPaused', this.#onRequestPaused.bind(this));
this.#client.on('Fetch.authRequired', this.#onAuthRequired.bind(this));
this.#client.on(
'Network.requestWillBeSent',
this.#onRequestWillBeSent.bind(this)
);
this.#client.on(
'Network.requestServedFromCache',
this.#onRequestServedFromCache.bind(this)
);
this.#client.on(
'Network.responseReceived',
this.#onResponseReceived.bind(this)
);
this.#client.on(
'Network.loadingFinished',
this.#onLoadingFinished.bind(this)
);
this.#client.on('Network.loadingFailed', this.#onLoadingFailed.bind(this));
this.#client.on(
'Network.responseReceivedExtraInfo',
this.#onResponseReceivedExtraInfo.bind(this)
);
for (const [event, handler] of this.#handlers) {
this.#client.on(event, handler);
}
}
async updateClient(client: CDPSession): Promise<void> {
this.#client = client;
for (const [event, handler] of this.#handlers) {
this.#client.on(event, handler);
}
this.#deferredInit = undefined;
await this.initialize();
}
/**

@@ -132,0 +138,0 @@ * Initialize calls should avoid async dependencies between CDP calls as those

@@ -49,2 +49,3 @@ /**

CDPSessionEmittedEvents,
CDPSessionImpl,
isTargetClosedError,

@@ -131,2 +132,3 @@ } from './Connection.js';

#client: CDPSession;
#tabSession: CDPSession | undefined;
#target: CDPTarget;

@@ -294,2 +296,3 @@ #keyboard: CDPKeyboard;

this.#client = client;
this.#tabSession = client.parentSession();
this.#target = target;

@@ -313,2 +316,21 @@ this.#keyboard = new CDPKeyboard(client);

this.#setupEventListeners();
this.#tabSession?.on(CDPSessionEmittedEvents.Swapped, async newSession => {
this.#client = newSession;
assert(
this.#client instanceof CDPSessionImpl,
'CDPSession is not instance of CDPSessionImpl'
);
this.#target = this.#client._target();
assert(this.#target, 'Missing target on swap');
this.#keyboard.updateClient(newSession);
this.#mouse.updateClient(newSession);
this.#touchscreen.updateClient(newSession);
this.#accessibility.updateClient(newSession);
this.#emulationManager.updateClient(newSession);
this.#tracing.updateClient(newSession);
this.#coverage.updateClient(newSession);
await this.#frameManager.swapFrameTree(newSession);
this.#setupEventListeners();
});
}

@@ -1004,49 +1026,2 @@

override async waitForFrame(
urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>),
options: {timeout?: number} = {}
): Promise<Frame> {
const {timeout = this.#timeoutSettings.timeout()} = options;
let predicate: (frame: Frame) => Promise<boolean>;
if (isString(urlOrPredicate)) {
predicate = (frame: Frame) => {
return Promise.resolve(urlOrPredicate === frame.url());
};
} else {
predicate = (frame: Frame) => {
const value = urlOrPredicate(frame);
if (typeof value === 'boolean') {
return Promise.resolve(value);
}
return value;
};
}
const eventRace: Promise<Frame> = Deferred.race([
waitForEvent(
this.#frameManager,
FrameManagerEmittedEvents.FrameAttached,
predicate,
timeout,
this.#sessionCloseDeferred.valueOrThrow()
),
waitForEvent(
this.#frameManager,
FrameManagerEmittedEvents.FrameNavigated,
predicate,
timeout,
this.#sessionCloseDeferred.valueOrThrow()
),
...this.frames().map(async frame => {
if (await predicate(frame)) {
return frame;
}
return await eventRace;
}),
]);
return eventRace;
}
override async goBack(

@@ -1053,0 +1028,0 @@ options: WaitForOptions = {}

@@ -25,3 +25,3 @@ /**

import {CDPSession} from './Connection.js';
import {CDPSession, CDPSessionImpl} from './Connection.js';
import {CDPPage} from './Page.js';

@@ -88,2 +88,5 @@ import {Viewport} from './PuppeteerViewport.js';

this.#sessionFactory = sessionFactory;
if (this.#session && this.#session instanceof CDPSessionImpl) {
this.#session._setTarget(this);
}
}

@@ -94,2 +97,9 @@

*/
_subtype(): string | undefined {
return this.#targetInfo.subtype;
}
/**
* @internal
*/
_session(): CDPSession | undefined {

@@ -115,3 +125,6 @@ return this.#session;

}
return this.#sessionFactory(false);
return this.#sessionFactory(false).then(session => {
(session as CDPSessionImpl)._setTarget(this);
return session;
});
}

@@ -138,2 +151,4 @@

return TargetType.WEBVIEW;
case 'tab':
return TargetType.TAB;
default:

@@ -140,0 +155,0 @@ return TargetType.OTHER;

@@ -28,3 +28,4 @@ /**

targetInfo: Protocol.Target.TargetInfo,
session?: CDPSession
session?: CDPSession,
parentSession?: CDPSession
) => CDPTarget;

@@ -31,0 +32,0 @@

@@ -61,2 +61,9 @@ /**

/**
* @internal
*/
updateClient(client: CDPSession): void {
this.#client = client;
}
/**
* Starts a trace for the current page.

@@ -63,0 +70,0 @@ * @remarks

@@ -35,2 +35,3 @@ /**

import {CDPJSHandle} from './JSHandle.js';
import {Awaitable} from './types.js';

@@ -385,3 +386,3 @@ /**

eventName: string | symbol,
predicate: (event: T) => Promise<boolean> | boolean,
predicate: (event: T) => Awaitable<boolean>,
timeout: number,

@@ -388,0 +389,0 @@ abortPromise: Promise<Error> | Deferred<Error>

@@ -30,1 +30,11 @@ /**

: -1;
/**
* Only used for internal testing.
*
* @internal
*/
export const USE_TAB_TARGET =
typeof process !== 'undefined'
? process.env['PUPPETEER_INTERNAL_TAB_TARGET'] === 'true'
: false;

@@ -8,2 +8,2 @@ /**

*/
export const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶+)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶+)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6+)\",\"(?<argument>.+)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
export const source = "\"use strict\";var C=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of oe(e))!se.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=ne(e,o))||r.enumerable});return t};var le=t=>ie(C({},\"__esModule\",{value:!0}),t);var Oe={};u(Oe,{default:()=>Re});module.exports=le(Oe);var T=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},S=class extends T{},I=class extends T{#e;#t=\"\";set code(e){this.#e=e}get code(){return this.#e}set originalMessage(e){this.#t=e}get originalMessage(){return this.#t}};var qe=Object.freeze({TimeoutError:S,ProtocolError:I});var f=class t{#e=!1;#t=!1;#n;#r=()=>{};#o=new Promise(e=>{this.#r=e});#s;constructor(e){this.#s=e&&e.timeout>0?setTimeout(()=>{this.reject(new S(e.message))},e.timeout):void 0}#i(e){clearTimeout(this.#s),this.#n=e,this.#r()}resolve(e){this.#t||this.#e||(this.#e=!0,this.#i(e))}reject(e){this.#t||this.#e||(this.#t=!0,this.#i(e))}resolved(){return this.#e}finished(){return this.#e||this.#t}value(){return this.#n}async valueOrThrow(){if(await this.#o,this.#t)throw this.#n;return this.#n}static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error(\"Timeout cleared\"))}}};var G=new Map,X=t=>{let e=G.get(t);return e||(e=new Function(`return ${t}`)(),G.set(t,e),e)};var R={};u(R,{ariaQuerySelector:()=>ae,ariaQuerySelectorAll:()=>k});var ae=(t,e)=>window.__ariaQuerySelector(t,e),k=async function*(t,e){yield*await window.__ariaQuerySelectorAll(t,e)};var q={};u(q,{customQuerySelectors:()=>M});var O=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},M=new O;var D={};u(D,{pierceQuerySelector:()=>ce,pierceQuerySelectorAll:()=>ue});var ce=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ue=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var P=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#t,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},E=class{#e;#t;constructor(e){this.#e=e}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\"))}result(){return m(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},x=class{#e;#t;#n;#r;constructor(e,n){this.#e=e,this.#t=n}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#t)}async stop(){m(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}};var H={};u(H,{pQuerySelector:()=>Ie,pQuerySelectorAll:()=>re});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,\"pseudo-element\":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶*)\\))?/gu,\"pseudo-class\":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>¶*)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},fe=new Set([\"combinator\",\"comma\"]);var de=t=>{switch(t){case\"pseudo-element\":case\"pseudo-class\":return new RegExp(p[t].source.replace(\"(?<argument>\\xB6*)\",\"(?<argument>.*)\"),\"gu\");default:return p[t]}};function me(t,e){let n=0,r=\"\";for(;e<t.length;e++){let o=t[e];switch(o){case\"(\":++n;break;case\")\":--n;break}if(r+=o,n===0)return r}return r}function he(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!=\"string\")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],B=l.slice(0,h+1);B&&d.push(B),d.push({...a.groups,type:o,content:V});let z=l.slice(h+V.length+1);z&&d.push(z),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case\"string\":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case\"object\":r+=o.content.length,o.pos=[r-o.content.length,r],fe.has(o.type)&&(o.content=o.content.trim()||\" \");break}return n}var pe=/(['\"])([^\\\\\\n]+?)\\1/g,ye=/\\\\./g;function K(t,e=p){if(t=t.trim(),t===\"\")return[];let n=[];t=t.replace(ye,(i,s)=>(n.push({value:i,offset:s}),\"\\uE000\".repeat(i.length))),t=t.replace(pe,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${\"\\uE001\".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf(\"(\",i))>-1;){let l=me(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${\"\\xB6\".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=he(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=de(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*N(t,e){switch(t.type){case\"list\":for(let n of t.list)yield*N(n,t);break;case\"complex\":yield*N(t.left,t),yield*N(t.right,t);break;case\"compound\":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...N(t)].map(([n])=>n),e.map(n=>n.content).join(\"\")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ge=/\\\\[\\s\\S]/g,we=t=>t.length<=1?t:((t[0]==='\"'||t[0]===\"'\")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ge,e=>e[1]));function Y(t){let e=!0,n=K(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case\"combinator\":switch(l.content){case\">>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>\"),o.push(r);continue;case\">>>>\":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(\">>>>\"),o.push(r);continue}break;case\"pseudo-element\":if(!l.name.startsWith(\"-p-\"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:we(l.argument??\"\")});continue;case\"comma\":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var Q={};u(Q,{textQuerySelectorAll:()=>b});var Se=new Set([\"checkbox\",\"image\",\"radio\"]),be=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!Se.has(t.type),Te=new Set([\"SCRIPT\",\"STYLE\"]),w=t=>!Te.has(t.nodeName)&&!document.head?.contains(t),_=new WeakMap,Z=t=>{for(;t;)_.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},J=new WeakSet,Pe=new MutationObserver(t=>{for(let e of t)Z(e.target)}),g=t=>{let e=_.get(t);if(e||(e={full:\"\",immediate:[]},!w(t)))return e;let n=\"\";if(be(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",r=>{Z(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??\"\",n+=r.nodeValue??\"\";continue}n&&e.immediate.push(n),n=\"\",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),J.has(t)||(Pe.observe(t,{childList:!0,characterData:!0}),J.add(t))}return _.set(t,e),e};var b=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=b(r.shadowRoot,e):o=b(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var $={};u($,{checkVisibility:()=>xe,pierce:()=>A,pierceAll:()=>L});var Ee=[\"hidden\",\"collapse\"],xe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!Ne(n);return e===o?t:!1};function Ne(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ae=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*A(t){Ae(t)?yield t.shadowRoot:yield t}function*L(t){t=A(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>U});var U=function*(t,e){let r=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),o;for(;o=r.iterateNext();)yield o};var ve=/[-\\w\\P{ASCII}*]/,ee=t=>\"querySelectorAll\"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},F=class{#e;#t;#n=[];#r=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#t=r,this.#o()}async run(){if(typeof this.#r==\"string\")switch(this.#r.trimStart()){case\":scope\":this.#o();break}for(;this.#r!==void 0;this.#o()){let e=this.#r,n=this.#e;typeof e==\"string\"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){ee(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!ee(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*b(r,e.value);break;case\"xpath\":yield*U(r,e.value);break;case\"aria\":yield*k(r,e.value);break;default:let o=M.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#r=this.#n.shift();return}if(this.#t.length===0){this.#r=void 0;return}let e=this.#t.shift();switch(e){case\">>>>\":{this.elements=c.flatMap(this.elements,A),this.#o();break}case\">>>\":{this.elements=c.flatMap(this.elements,L),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},te=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?te(r,i):n<o?-1:1},Ce=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>te(r,o)).map(([r])=>r)},re=function(t,e){let n,r;try{[n,r]=Y(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s==\"string\"?++i:i=0,i>1))}))throw new v(e,\"Multiple deep combinators found in sequence.\");return Ce(c.flatMap(n,o=>{let i=new F(t,e,o);return i.run(),i.elements}))},Ie=async function(t,e){for await(let n of re(t,e))return n;return null};var ke=Object.freeze({...R,...q,...D,...H,...Q,...$,...j,Deferred:f,createFunction:X,createTextContent:g,IntervalPoller:x,isSuitableNodeForTextMatching:w,MutationPoller:P,RAFPoller:E}),Re=ke;\n";
/**
* @internal
*/
export const packageVersion = '21.1.0';
export const packageVersion = '21.1.1';

@@ -138,3 +138,3 @@ /**

#interval?: NodeJS.Timer;
#interval?: NodeJS.Timeout;
#deferred?: Deferred<T>;

@@ -141,0 +141,0 @@ constructor(fn: () => Promise<T>, ms: number) {

@@ -28,2 +28,3 @@ /**

import {debugError} from '../common/util.js';
import {USE_TAB_TARGET} from '../environment.js';
import {assert} from '../util/assert.js';

@@ -183,2 +184,3 @@

'--disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints',
...(USE_TAB_TARGET ? [] : ['--disable-features=Prerender2']),
'--disable-hang-monitor',

@@ -185,0 +187,0 @@ '--disable-ipc-flooding-protection',

@@ -5,2 +5,3 @@ {

"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "../lib/cjs/puppeteer"

@@ -7,0 +8,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc