import '../../../assert/js/assert.js';
import '../../../query-string-machine/js/QueryStringMachine.js';
import '../../../globals.js';
import { PropertyOptions } from '../../../axon/js/Property.js';
import TProperty from '../../../axon/js/TProperty.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import RequiredOption from '../../../phet-core/js/types/RequiredOption.js';
import '../../../sherpa/lib/himalaya-1.1.0.js';
import PhetioObject, { PhetioObjectOptions } from '../../../tandem/js/PhetioObject.js';
import IOType from '../../../tandem/js/types/IOType.js';
import { Font, HimalayaNode, Node, NodeOptions, TextBoundsMethod, TPaint } from '../imports.js';
export type RichTextAlign = 'left' | 'center' | 'right';
export type RichTextHref = (() => void) | string;
type RichTextLinksObject = Record<string, RichTextHref>;
export type RichTextLinks = RichTextLinksObject | true;
type SelfOptions = {
    boundsMethod?: TextBoundsMethod;
    font?: Font | string;
    fill?: TPaint;
    stroke?: TPaint;
    lineWidth?: number;
    subScale?: number;
    subXSpacing?: number;
    subYOffset?: number;
    supScale?: number;
    supXSpacing?: number;
    supYOffset?: number;
    capHeightScale?: number;
    underlineLineWidth?: number;
    underlineHeightScale?: number;
    strikethroughLineWidth?: number;
    strikethroughHeightScale?: number;
    linkFill?: TPaint;
    linkEventsHandled?: boolean;
    links?: RichTextLinks;
    nodes?: Record<string, Node>;
    tags?: Record<string, (node: Node) => Node>;
    replaceNewlines?: boolean;
    align?: RichTextAlign;
    leading?: number;
    lineWrap?: number | 'stretch' | null;
    stringProperty?: TReadOnlyProperty<string> | null;
    stringPropertyOptions?: PropertyOptions<string>;
    string?: string | number;
};
export type RichTextOptions = SelfOptions & NodeOptions;
declare const RichText_base: typeof Node & import("../../../phet-core/js/types/Constructor.js").default<import("../imports.js").TWidthSizable>;
export default class RichText extends RichText_base {
    private readonly _stringProperty;
    private _font;
    private _boundsMethod;
    private _fill;
    private _stroke;
    private _lineWidth;
    private _subScale;
    private _subXSpacing;
    private _subYOffset;
    private _supScale;
    private _supXSpacing;
    private _supYOffset;
    private _capHeightScale;
    private _underlineLineWidth;
    private _underlineHeightScale;
    private _strikethroughLineWidth;
    private _strikethroughHeightScale;
    private _linkFill;
    private _linkEventsHandled;
    private _links;
    private _nodes;
    private _tags;
    private _replaceNewlines;
    private _align;
    private _leading;
    private _lineWrap;
    private _linkItems;
    private _hasAddedLeafToLine;
    private lineContainer;
    private needPendingMinimumWidth;
    private pendingMinimumWidth;
    static readonly STRING_PROPERTY_TANDEM_NAME = "stringProperty";
    constructor(string: string | number | TReadOnlyProperty<string>, providedOptions?: RichTextOptions);
    /**
     * Called when our stringProperty changes values.
     */
    private onStringPropertyChange;
    /**
     * See documentation for Node.setVisibleProperty, except this is for the text string.
     *
     * NOTE: Setting the .string after passing a truly read-only Property will fail at runtime. We choose to allow passing
     * in read-only Properties for convenience.
     */
    setStringProperty(newTarget: TReadOnlyProperty<string> | null): this;
    set stringProperty(property: TReadOnlyProperty<string> | null);
    get stringProperty(): TProperty<string>;
    /**
     * Like Node.getVisibleProperty, but for the text string. Note this is not the same as the Property provided in
     * setStringProperty. Thus is the nature of TinyForwardingProperty.
     */
    getStringProperty(): TProperty<string>;
    /**
     * RichText supports a "string" selection mode, in which it will map to its stringProperty (if applicable), otherwise is
     * uses the default mouse-hit target from the supertype.
     */
    getPhetioMouseHitTarget(fromLinking?: boolean): PhetioObject | 'phetioNotSelectable';
    private getStringPropertyPhetioMouseHitTarget;
    /**
     * See documentation and comments in Node.initializePhetioObject
     */
    initializePhetioObject(baseOptions: Partial<PhetioObjectOptions>, providedOptions: RichTextOptions): void;
    /**
     * When called, will rebuild the node structure for this RichText
     */
    private rebuildRichText;
    /**
     * Cleans "recursively temporary disposes" the children.
     */
    private freeChildrenToPool;
    /**
     * Releases references.
     */
    dispose(): void;
    /**
     * Appends a finished line, applying any necessary leading.
     */
    private appendLine;
    /**
     * If we end up with the equivalent of "no" content, toss in a basically empty leaf so that we get valid bounds
     * (0 width, correctly-positioned height). See https://github.com/phetsims/scenery/issues/769.
     */
    private appendEmptyLeaf;
    /**
     * Aligns all lines attached to the lineContainer.
     */
    private alignLines;
    /**
     * Main recursive function for constructing the RichText Node tree.
     *
     * We'll add any relevant content to the containerNode. The element will be mutated as things are added, so that
     * whenever content is added to the Node tree it will be removed from the element tree. This means we can pause
     * whenever (e.g. when a line-break is encountered) and the rest will be ready for parsing the next line.
     *
     * @param containerNode - The node where child elements should be placed
     * @param element - See Himalaya's element specification
     *                      (https://github.com/andrejewski/himalaya/blob/master/text/ast-spec-v0.md)
     * @param font - The font to apply at this level
     * @param fill - Fill to apply
     * @param isLTR - True if LTR, false if RTL (handles RTL strings properly)
     * @param widthAvailable - How much width we have available before forcing a line break (for lineWrap)
     * @returns - Whether a line break was reached
     */
    private appendElement;
    /**
     * Sets the string displayed by our node.
     *
     * NOTE: Encoding HTML entities is required, and malformed HTML is not accepted.
     *
     * @param string - The string to display. If it's a number, it will be cast to a string
     */
    setString(string: string | number): this;
    set string(value: string | number);
    get string(): string;
    /**
     * Returns the string displayed by our text Node.
     */
    getString(): string;
    /**
     * Sets the method that is used to determine bounds from the text. See Text.setBoundsMethod for details
     */
    setBoundsMethod(method: TextBoundsMethod): this;
    set boundsMethod(value: TextBoundsMethod);
    get boundsMethod(): TextBoundsMethod;
    /**
     * Returns the current method to estimate the bounds of the text. See setBoundsMethod() for more information.
     */
    getBoundsMethod(): TextBoundsMethod;
    /**
     * Sets the font of our node.
     */
    setFont(font: Font | string): this;
    set font(value: Font | string);
    get font(): Font | string;
    /**
     * Returns the current Font
     */
    getFont(): Font | string;
    /**
     * Sets the fill of our text.
     */
    setFill(fill: TPaint): this;
    set fill(value: TPaint);
    get fill(): TPaint;
    /**
     * Returns the current fill.
     */
    getFill(): TPaint;
    /**
     * Sets the stroke of our text.
     */
    setStroke(stroke: TPaint): this;
    set stroke(value: TPaint);
    get stroke(): TPaint;
    /**
     * Returns the current stroke.
     */
    getStroke(): TPaint;
    /**
     * Sets the lineWidth of our text.
     */
    setLineWidth(lineWidth: number): this;
    set lineWidth(value: number);
    get lineWidth(): number;
    /**
     * Returns the current lineWidth.
     */
    getLineWidth(): number;
    /**
     * Sets the scale (relative to 1) of any string under subscript (<sub>) elements.
     */
    setSubScale(subScale: number): this;
    set subScale(value: number);
    get subScale(): number;
    /**
     * Returns the scale (relative to 1) of any string under subscript (<sub>) elements.
     */
    getSubScale(): number;
    /**
     * Sets the horizontal spacing before any subscript (<sub>) elements.
     */
    setSubXSpacing(subXSpacing: number): this;
    set subXSpacing(value: number);
    get subXSpacing(): number;
    /**
     * Returns the horizontal spacing before any subscript (<sub>) elements.
     */
    getSubXSpacing(): number;
    /**
     * Sets the adjustment offset to the vertical placement of any subscript (<sub>) elements.
     */
    setSubYOffset(subYOffset: number): this;
    set subYOffset(value: number);
    get subYOffset(): number;
    /**
     * Returns the adjustment offset to the vertical placement of any subscript (<sub>) elements.
     */
    getSubYOffset(): number;
    /**
     * Sets the scale (relative to 1) of any string under superscript (<sup>) elements.
     */
    setSupScale(supScale: number): this;
    set supScale(value: number);
    get supScale(): number;
    /**
     * Returns the scale (relative to 1) of any string under superscript (<sup>) elements.
     */
    getSupScale(): number;
    /**
     * Sets the horizontal spacing before any superscript (<sup>) elements.
     */
    setSupXSpacing(supXSpacing: number): this;
    set supXSpacing(value: number);
    get supXSpacing(): number;
    /**
     * Returns the horizontal spacing before any superscript (<sup>) elements.
     */
    getSupXSpacing(): number;
    /**
     * Sets the adjustment offset to the vertical placement of any superscript (<sup>) elements.
     */
    setSupYOffset(supYOffset: number): this;
    set supYOffset(value: number);
    get supYOffset(): number;
    /**
     * Returns the adjustment offset to the vertical placement of any superscript (<sup>) elements.
     */
    getSupYOffset(): number;
    /**
     * Sets the expected cap height (baseline to top of capital letters) as a scale of the detected distance from the
     * baseline to the top of the text bounds.
     */
    setCapHeightScale(capHeightScale: number): this;
    set capHeightScale(value: number);
    get capHeightScale(): number;
    /**
     * Returns the expected cap height (baseline to top of capital letters) as a scale of the detected distance from the
     * baseline to the top of the text bounds.
     */
    getCapHeightScale(): number;
    /**
     * Sets the lineWidth of underline lines.
     */
    setUnderlineLineWidth(underlineLineWidth: number): this;
    set underlineLineWidth(value: number);
    get underlineLineWidth(): number;
    /**
     * Returns the lineWidth of underline lines.
     */
    getUnderlineLineWidth(): number;
    /**
     * Sets the underline height adjustment as a proportion of the detected distance from the baseline to the top of the
     * text bounds.
     */
    setUnderlineHeightScale(underlineHeightScale: number): this;
    set underlineHeightScale(value: number);
    get underlineHeightScale(): number;
    /**
     * Returns the underline height adjustment as a proportion of the detected distance from the baseline to the top of the
     * text bounds.
     */
    getUnderlineHeightScale(): number;
    /**
     * Sets the lineWidth of strikethrough lines.
     */
    setStrikethroughLineWidth(strikethroughLineWidth: number): this;
    set strikethroughLineWidth(value: number);
    get strikethroughLineWidth(): number;
    /**
     * Returns the lineWidth of strikethrough lines.
     */
    getStrikethroughLineWidth(): number;
    /**
     * Sets the strikethrough height adjustment as a proportion of the detected distance from the baseline to the top of the
     * text bounds.
     */
    setStrikethroughHeightScale(strikethroughHeightScale: number): this;
    set strikethroughHeightScale(value: number);
    get strikethroughHeightScale(): number;
    /**
     * Returns the strikethrough height adjustment as a proportion of the detected distance from the baseline to the top of the
     * text bounds.
     */
    getStrikethroughHeightScale(): number;
    /**
     * Sets the color of links. If null, no fill will be overridden.
     */
    setLinkFill(linkFill: TPaint): this;
    set linkFill(value: TPaint);
    get linkFill(): TPaint;
    /**
     * Returns the color of links.
     */
    getLinkFill(): TPaint;
    /**
     * Sets whether link clicks will call event.handle().
     */
    setLinkEventsHandled(linkEventsHandled: boolean): this;
    set linkEventsHandled(value: boolean);
    get linkEventsHandled(): boolean;
    /**
     * Returns whether link events will be handled.
     */
    getLinkEventsHandled(): boolean;
    setLinks(links: RichTextLinks): this;
    /**
     * Returns whether link events will be handled.
     */
    getLinks(): RichTextLinks;
    set links(value: RichTextLinks);
    get links(): RichTextLinks;
    setNodes(nodes: Record<string, Node>): this;
    getNodes(): Record<string, Node>;
    set nodes(value: Record<string, Node>);
    get nodes(): Record<string, Node>;
    setTags(tags: Record<string, (node: Node) => Node>): this;
    getTags(): Record<string, (node: Node) => Node>;
    set tags(value: Record<string, (node: Node) => Node>);
    get tags(): Record<string, (node: Node) => Node>;
    /**
     * Sets whether newlines are replaced with <br>
     */
    setReplaceNewlines(replaceNewlines: boolean): this;
    set replaceNewlines(value: boolean);
    get replaceNewlines(): boolean;
    getReplaceNewlines(): boolean;
    /**
     * Sets the alignment of text (only relevant if there are multiple lines).
     */
    setAlign(align: RichTextAlign): this;
    set align(value: RichTextAlign);
    get align(): RichTextAlign;
    /**
     * Returns the current alignment of the text (only relevant if there are multiple lines).
     */
    getAlign(): RichTextAlign;
    /**
     * Sets the leading (spacing between lines)
     */
    setLeading(leading: number): this;
    set leading(value: number);
    get leading(): number;
    /**
     * Returns the leading (spacing between lines)
     */
    getLeading(): number;
    /**
     * Sets the line wrap width for the text (or null if none is desired). Lines longer than this length will wrap
     * automatically to the next line.
     *
     * @param lineWrap - If it's a number, it should be greater than 0.
     */
    setLineWrap(lineWrap: RequiredOption<SelfOptions, 'lineWrap'>): this;
    set lineWrap(value: RequiredOption<SelfOptions, 'lineWrap'>);
    get lineWrap(): RequiredOption<SelfOptions, 'lineWrap'>;
    /**
     * Returns the line wrap width.
     */
    getLineWrap(): RequiredOption<SelfOptions, 'lineWrap'>;
    mutate(options?: RichTextOptions): this;
    /**
     * Returns a wrapped version of the string with a font specifier that uses the given font object.
     *
     * NOTE: Does an approximation of some font values (using <b> or <i>), and cannot force the lack of those if it is
     * included in bold/italic exterior tags.
     */
    static stringWithFont(str: string, font: Font): string;
    /**
     * Stringifies an HTML subtree defined by the given element.
     */
    static himalayaElementToString(element: HimalayaNode): string;
    /**
     * Stringifies an HTML subtree defined by the given element, but removing certain tags that we don't need for
     * accessibility (like <a>, <span>, etc.), and adding in tags we do want (see ACCESSIBLE_TAGS).
     */
    static himalayaElementToAccessibleString(element: HimalayaNode): string;
    /**
     * Transforms a given string with HTML markup into a string suitable for screen readers.
     * Preserves basic styling tags while removing non-accessible markup.
     */
    static getAccessibleStringProperty(stringProperty: TReadOnlyProperty<string>): TReadOnlyProperty<string>;
    /**
     * Takes the element.content from himalaya, unescapes HTML entities, and applies the proper directional tags.
     *
     * See https://github.com/phetsims/scenery-phet/issues/315
     */
    static contentToString(content: string, isLTR?: boolean): string;
    static RichTextIO: IOType;
}
export {};
//# sourceMappingURL=RichText.d.ts.map