export declare namespace xpath { } export declare namespace xpath { type XPathType = xpath.XString | xpath.XNumber | xpath.XNodeSet | xpath.XBoolean; interface XPathFunction { (c: xpath.XPathContext): R; (c: xpath.XPathContext, p0: P0): R; (c: xpath.XPathContext, p0: P0, p1: P1): R; (c: xpath.XPathContext, p0: P0, p1: P2, p2: P2): R;

(c: xpath.XPathContext, ...r: P[]): R; (c: xpath.XPathContext, p0: P0, ...r: P[]): R; (c: xpath.XPathContext, p0: P0, p1: P1, ...r: P[]): R; (c: xpath.XPathContext, p0: P0, p1: P1, p2: P2, ...r: P[]): R; } interface IXPathNSResolver { lookupNamespaceURI(prefix: string): string | null; } class NamespaceResolver { constructor(); getNamespace(prefix: string, n: Node): string | null; } class VariableResolver { constructor(); getVariable(ln: string, ns: string): XPathType | null; } class FunctionResolver { static getFunctionFromContext(qName: string, context: XPathContext): XPathFunction | undefined; protected functions: { [k: string]: XPathFunction; }; constructor(thisArgs?: any); addFunction(ns: string, ln: string, f: XPathFunction): void; addStandardFunctions(): void; getFunction(localName: string, namespace: string): XPathFunction | undefined; } class XPath { static readonly XML_NAMESPACE_URI: string; static readonly XMLNS_NAMESPACE_URI: string; readonly expression: XPathExpression; constructor(expression: XPathExpression); evaluate(context: XPathContext): XPathResult; } class XPathParser { static readonly DOUBLEDOT: 2; static readonly DOUBLECOLON: 3; static readonly DOUBLESLASH: 4; static readonly NOTEQUAL: 5; static readonly LESSTHANOREQUAL: 6; static readonly GREATERTHANOREQUAL: 7; static readonly AND: 8; static readonly OR: 9; static readonly MOD: 10; static readonly DIV: 11; static readonly MULTIPLYOPERATOR: 12; static readonly FUNCTIONNAME: 13; static readonly AXISNAME: 14; static readonly LITERAL: 15; static readonly NUMBER: 16; static readonly ASTERISKNAMETEST: 17; static readonly QNAME: 18; static readonly NCNAMECOLONASTERISK: 19; static readonly NODETYPE: 20; static readonly PROCESSINGINSTRUCTIONWITHLITERAL: 21; static readonly EQUALS: 22; static readonly LESSTHAN: 23; static readonly GREATERTHAN: 24; static readonly PLUS: 25; static readonly MINUS: 26; static readonly BAR: 27; static readonly SLASH: 28; static readonly LEFTPARENTHESIS: 29; static readonly RIGHTPARENTHESIS: 30; static readonly COMMA: 31; static readonly AT: 32; static readonly LEFTBRACKET: 33; static readonly RIGHTBRACKET: 34; static readonly DOT: 35; static readonly DOLLAR: 36; constructor(); tokenize(input: string): [number[], string[]]; parse(input: string): XPath; private init; } class XPathResult { /** `ANY_TYPE = 0` */ static readonly ANY_TYPE: 0; /** `NUMBER_TYPE = 1` */ static readonly NUMBER_TYPE: 1; /** `STRING_TYPE = 2` */ static readonly STRING_TYPE: 2; /** `BOOLEAN_TYPE = 3` */ static readonly BOOLEAN_TYPE: 3; /** `UNORDERED_NODE_ITERATOR_TYPE = 4` */ static readonly UNORDERED_NODE_ITERATOR_TYPE: 4; /** `ORDERED_NODE_ITERATOR_TYPE = 5` */ static readonly ORDERED_NODE_ITERATOR_TYPE: 5; /** `UNORDERED_NODE_SNAPSHOT_TYPE = 6` */ static readonly UNORDERED_NODE_SNAPSHOT_TYPE: 6; /** `ORDERED_NODE_SNAPSHOT_TYPE = 7` */ static readonly ORDERED_NODE_SNAPSHOT_TYPE: 7; /** `ANY_UNORDERED_NODE_TYPE = 8` */ static readonly ANY_UNORDERED_NODE_TYPE: 8; /** `FIRST_ORDERED_NODE_TYPE = 9` */ static readonly FIRST_ORDERED_NODE_TYPE: 9; readonly resultType: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; readonly invalidIteratorState?: false; readonly snapshotLength?: number; readonly numberValue?: number; readonly stringValue?: string; readonly booleanValue?: boolean; readonly singleNodeValue?: Node; protected readonly nodes?: Node[]; protected iteratorIndex: number; constructor(v: any, t: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9); iterateNext(): Node; snapshotItem(index: number): Node; } class XPathContext { variableResolver: VariableResolver; namespaceResolver: NamespaceResolver; functionResolver: FunctionResolver; contextNode?: Node; contextSize?: number; contextPosition?: number; caseInsensitive?: boolean; allowAnyNamespaceForNoPrefix?: boolean; constructor(vr?: VariableResolver, nr?: NamespaceResolver, fr?: FunctionResolver); extend(newProps: T): XPathContext & T; } interface IExpression { toString(): string; evaluate(c?: XPathContext): IExpression; } abstract class ITypeExpression implements IExpression { toString(): string; evaluate(c?: XPathContext): this; string(): XString; number(): XNumber; bool(): XBoolean; nodeset(): XNodeSet; stringValue(): string; numberValue(): number; booleanValue(): boolean; equals(r: ITypeExpression): XBoolean; notequal(r: ITypeExpression): XBoolean; lessthan(r: ITypeExpression): XBoolean; greaterthan(r: ITypeExpression): XBoolean; lessthanorequal(r: ITypeExpression): XBoolean; greaterthanorequal(r: ITypeExpression): XBoolean; protected init(): void; } class XString extends ITypeExpression { constructor(s?: string | number | boolean); } class XBoolean extends ITypeExpression { constructor(s?: string | number | boolean); not(): XBoolean; } class XNumber extends ITypeExpression { constructor(s?: string | number | boolean); negate(): XNumber; plus(r: XNumber): XNumber; minus(r: XNumber): XNumber; multiply(r: XNumber): XNumber; div(r: XNumber): XNumber; mod(r: XNumber): XNumber; } class XNodeSet extends ITypeExpression { readonly size: number; protected nodes: Node[]; stringForNode(node: Node): string; stringForContainerNode(node: Node): string; first(): Node | null; add(node: Node): void; addArray(nodes: ArrayLike): void; toArray(): Node[]; toUnsortedArray(): Node[]; compareWithString(ref: XString, comparator: (v: XString, r: XString) => XBoolean): XBoolean; compareWithNumber(ref: XNumber, comparator: (v: XNumber, r: XNumber) => XBoolean): XBoolean; compareWithBoolean(ref: XBoolean, comparator: (v: XBoolean, r: XBoolean) => XBoolean): XBoolean; compareWithNodeSet(ref: XNodeSet, comparator: (v: XNodeSet, r: XNodeSet) => XBoolean): XBoolean; compareWith(ref: ITypeExpression, comparator: (v: ITypeExpression, r: ITypeExpression) => XBoolean): XBoolean; } interface IXPathSelect { (expression: string, node: Node, single?: false): string | number | boolean | Array; (expression: string, node: Node, single: true): Node | Attr | string | number | boolean | undefined; } const select: IXPathSelect; function selectWithResolver(expression: string, node: Node, resolver: IXPathNSResolver | null | undefined, single?: false): string | number | boolean | Array; function selectWithResolver(expression: string, node: Node, resolver: IXPathNSResolver | null | undefined, single: true): Node | Attr | string | number | boolean | undefined; function select1(expression: string, node?: Node): Node | Attr | string | number | boolean | undefined; function evaluate(expression: string, contextNode: Node, resolver: IXPathNSResolver, type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9, result: XPathResult): XPathResult; function useNamespaces(namespaceMap: { [name: string]: string; }): IXPathSelect; function createExpression(e: string, r?: IXPathNSResolver): XPathExpression; function createNSResolver(node: Node): IXPathNSResolver; interface IXPathEvaluatorOptions { namespaces?: NamespaceResolver | { [k: string]: string; } | ((prefix: string, n: Node) => string | null); functions?: FunctionResolver | { [k: string]: XPathFunction; } | ((ln: string, ns: string) => XPathFunction | undefined); variables?: VariableResolver | { [k: string]: string; } | ((prefix: string, n: Node) => string | null); node?: Node; allowAnyNamespaceForNoPrefix?: boolean; isHTML?: boolean; } interface IXPathEvaluator { evaluate(options: IXPathEvaluatorOptions): T; evaluateNumber(options: IXPathEvaluatorOptions): number; evaluateString(options: IXPathEvaluatorOptions): string; evaluateBoolean(options: IXPathEvaluatorOptions): boolean; evaluateNodeSet(options: IXPathEvaluatorOptions): XNodeSet; select(options: IXPathEvaluatorOptions): Node[]; select1(options: IXPathEvaluatorOptions): Node | undefined; } function parse(input: string): IXPathEvaluator; } export default xpath;