import '../../assert/js/assert.js';
import './PhetioIDUtils.js';
import '../../query-string-machine/js/QueryStringMachine.js';
import '../../globals.js';
import PhetioObject from './PhetioObject.js';
import { PhetioID } from './TandemConstants.js';
export declare const DYNAMIC_ARCHETYPE_NAME: any;
type PhetioObjectListener = {
    addPhetioObject: (phetioObject: PhetioObject) => void;
    removePhetioObject: (phetioObject: PhetioObject) => void;
};
export type TandemOptions = {
    required?: boolean;
    supplied?: boolean;
    isValidTandemName?: (name: string) => boolean;
};
declare class Tandem {
    parentTandem: Tandem | null;
    readonly name: string;
    readonly phetioID: PhetioID;
    readonly children: Record<string, Tandem>;
    readonly required: boolean;
    readonly supplied: boolean;
    private isDisposed;
    static readonly SCREEN_TANDEM_NAME_SUFFIX = "Screen";
    /**
     * Typically, sims will create tandems using `tandem.createTandem`.  This constructor is used internally or when
     * a tandem must be created from scratch.
     *
     * @param parentTandem - parent for a child tandem, or null for a root tandem
     * @param name - component name for this level, like 'resetAllButton'
     * @param [providedOptions]
     */
    constructor(parentTandem: Tandem | null, name: string, providedOptions?: TandemOptions);
    protected static getRegexFromCharacterClass(tandemCharacterClass?: string): RegExp;
    /**
     * If the provided tandem is not supplied, support the ?printMissingTandems query parameter for extra logging during
     * initial instrumentation.
     */
    static onMissingTandem(tandem: Tandem): void;
    /**
     * Get a stack trace from a new instance of an Error(). This also uses window.Error.stackTraceLimit to expand the
     * length of the stack trace. This can be useful in spots where the stack is the only information we have about
     * where we are in common code (like for knowing where to provide a Tandem  for PhET-iO instrumentation).
     * @param limit - set to Error.stackTraceLimit just for a single stack trace, then return to the previous value after.
     */
    private static captureStackTrace;
    /**
     * Adds a PhetioObject.  For example, it could be an axon Property, SCENERY/Node or SUN/RoundPushButton.
     * phetioEngine listens for when PhetioObjects are added and removed to keep track of them for PhET-iO.
     */
    addPhetioObject(phetioObject: PhetioObject): void;
    /**
     * Returns true if this Tandem has the specified ancestor Tandem.
     */
    hasAncestor(ancestor: Tandem): boolean;
    /**
     * Removes a PhetioObject and signifies to listeners that it has been removed.
     */
    removePhetioObject(phetioObject: PhetioObject): void;
    /**
     * Used for creating new tandems, extends this Tandem's options with the passed-in options.
     */
    getExtendedOptions(options?: TandemOptions): TandemOptions;
    /**
     * Create a new Tandem by appending the given id, or if the child Tandem already exists, return it instead.
     */
    createTandem(name: string, options?: TandemOptions): Tandem;
    /**
     * Create a new Tandem by indexing with the specified index.  Note that it increments by 1 so that index 0 is
     * "1" in the tandem name.
     * For example:
     * - createTandem( 'foo', 0 ) => 'foo1'
     */
    createTandem1Indexed(name: string, index: number, options?: TandemOptions): Tandem;
    hasChild(name: string): boolean;
    addChild(name: string, tandem: Tandem): void;
    /**
     * Fire a callback on all descendants of this Tandem
     */
    iterateDescendants(callback: (t: Tandem) => void): void;
    private removeChild;
    private dispose;
    /**
     * For API validation, each PhetioObject has a corresponding archetype PhetioObject for comparison. Non-dynamic
     * PhetioObjects have the trivial case where its archetypal phetioID is the same as its phetioID.
     */
    getArchetypalPhetioID(): PhetioID;
    /**
     * Creates a group tandem for creating multiple indexed child tandems, such as:
     * sim.screen.model.electron0
     * sim.screen.model.electron1
     *
     * In this case, 'sim.screen.model.electron' is the string passed to createGroupTandem.
     *
     * Used for arrays, observable arrays, or when many elements of the same type are created and they do not otherwise
     * have unique identifiers.
     */
    createGroupTandem(name: string): GroupTandem;
    equals(tandem: Tandem): boolean;
    /**
     * Adds a listener that will be notified when items are registered/deregistered
     */
    static addPhetioObjectListener(phetioObjectListener: PhetioObjectListener): void;
    /**
     * After all listeners have been added, then Tandem can be launched.  This registers all of the buffered PhetioObjects
     * and subsequent PhetioObjects will be registered directly.
     */
    static launch(): void;
    /**
     * ONLY FOR TESTING!!!!
     * This was created to "undo" launch so that tests can better expose cases around calling Tandem.launch()
     */
    static unlaunch(): void;
    /**
     * Add a listener that will fire when Tandem is launched
     */
    static addLaunchListener(listener: () => void): void;
    /**
     * Expose collected missing tandems only populated from specific query parameter, see phetioPrintMissingTandems
     * (phet-io internal)
     */
    static readonly missingTandems: {
        required: Array<{
            phetioID: PhetioID;
            stack: string;
        }>;
        optional: Array<{
            phetioID: PhetioID;
            stack: string;
        }>;
    };
    /**
     * If PhET-iO is enabled in this runtime.
     */
    static readonly PHET_IO_ENABLED: boolean;
    /**
     * If PhET-iO is running with validation enabled.
     */
    static readonly VALIDATION: boolean;
    /**
     * For the API file, the key name for the metadata section.
     */
    static readonly METADATA_KEY = "_metadata";
    /**
     * For the API file, the key name for the data section.
     */
    static readonly DATA_KEY = "_data";
    static launched: boolean;
    static readonly bufferedPhetioObjects: PhetioObject[];
    createTandemFromPhetioID(phetioID: PhetioID): Tandem;
    private static readonly RootTandem;
    /**
     * The root tandem for a simulation
     */
    static readonly ROOT: Tandem;
    /**
     * Many simulation elements are nested under "general". This tandem is for elements that exists in all sims. For a
     * place to put simulation specific globals, see `GLOBAL`
     *
     * @constant
     * @type {Tandem}
     */
    private static readonly GENERAL;
    /**
     * Used in unit tests
     */
    static readonly ROOT_TEST: Tandem;
    /**
     * Tandem for model simulation elements that are general to all sims.
     */
    static readonly GENERAL_MODEL: Tandem;
    /**
     * Tandem for view simulation elements that are general to all sims.
     */
    static readonly GENERAL_VIEW: Tandem;
    /**
     * Tandem for controller simulation elements that are general to all sims.
     */
    static readonly GENERAL_CONTROLLER: Tandem;
    /**
     * Simulation elements that don't belong in screens should be nested under "global". Note that this tandem should only
     * have simulation specific elements in them. Instrument items used by all sims under `Tandem.GENERAL`. Most
     * likely simulations elements should not be directly under this, but instead either under the model or view sub
     * tandems.
     *
     * @constant
     * @type {Tandem}
     */
    private static readonly GLOBAL;
    /**
     * Model simulation elements that don't belong in specific screens should be nested under this Tandem. Note that this
     * tandem should only have simulation specific elements in them.
     */
    static readonly GLOBAL_MODEL: Tandem;
    /**
     * View simulation elements that don't belong in specific screens should be nested under this Tandem. Note that this
     * tandem should only have simulation specific elements in them.
     */
    static readonly GLOBAL_VIEW: Tandem;
    /**
     * Colors used in the simulation.
     */
    static readonly COLORS: Tandem;
    /**
     * Colors used in the simulation.
     */
    static readonly STRINGS: Tandem;
    /**
     * Get the Tandem location for model strings. Provide the camelCased repo name for where the string should be
     * organized. This will default to the sim's name. See https://github.com/phetsims/tandem/issues/298
     */
    static getStringsTandem(moduleName?: string): Tandem;
    /**
     * Get the Tandem location for derived model strings. Provide the camelCased repo name for where the string should be
     * organized. This will default to the sim's name. See https://github.com/phetsims/tandem/issues/298
     */
    static getDerivedStringsTandem(moduleName?: string): Tandem;
    /**
     * In TypeScript, optionize already knows that `tandem` may be undefined, just use `options.tandem?` See https://github.com/phetsims/tandem/issues/289
     * Used to indicate a common code component that supports tandem, but doesn't require it.  If a tandem is not
     * passed in, then it will not be instrumented.
     */
    static readonly OPTIONAL: Tandem;
    /**
     * To be used exclusively to opt out of situations where a tandem is required, see https://github.com/phetsims/tandem/issues/97.
     */
    static readonly OPT_OUT: Tandem;
    /**
     * Some common code (such as Checkbox or RadioButton) must always be instrumented.
     */
    static readonly REQUIRED: Tandem;
    /**
     * Use this as the parent tandem for Properties that are related to sim-specific preferences.
     */
    static readonly PREFERENCES: Tandem;
}
/**
 * Group Tandem -- Declared in the same file to avoid circular reference errors in module loading.
 */
declare class GroupTandem extends Tandem {
    private readonly groupName;
    private groupMemberIndex;
    /**
     * create with Tandem.createGroupTandem
     */
    constructor(parentTandem: Tandem, name: string);
    /**
     * Creates the next tandem in the group.
     */
    createNextTandem(): Tandem;
}
export default Tandem;
//# sourceMappingURL=Tandem.d.ts.map