<commit_before>/**
 * Defines a contract a class must implement in order to configure a State
 */
export interface StateInfo {
    /**
     * Gets the unique key
     */
    key: string;
    /**
     * Gets the default NavigationData for this State
     */
    defaults?: any;
    /**
     * Gets the default NavigationData Types for  this State
     */
    defaultTypes?: any;
    /**
     * Gets the textual description of the state
     */
    title?: string;
    /**
     * Gets the route Url patterns
     */
    route?: string | string[];
    /**
     * Gets a value that indicates whether to maintain the crumb trail
     */
    trackCrumbTrail?: boolean | string;
    /**
     * Gets a value that indicates whether NavigationData Types are
     * preserved when navigating
     */
    trackTypes?: boolean;
    /**
     * Gets the additional state attributes
     */
    [extras: string]: any;
}

/**
 * Represents a view and is the destination of a navigation
 */
export class State implements StateInfo {
    /**
     * Gets the unique key
     */
    key: string;
    /**
     * Gets the default NavigationData for this State
     */
    defaults: any;
    /**
     * Gets the default NavigationData Types for  this State
     */
    defaultTypes: any;
    /**
     * Gets the formatted default NavigationData for this State
     */
    formattedDefaults: any;
    /**
     * Gets the formatted default array NavigationData for this State
     */
    formattedArrayDefaults: { [index: string]: string[]; };
    /**
     * Gets the textual description of the state
     */
    title: string;
    /**
     * Gets the route Url patterns
     */
    route: string | string[];
    /**
     * Gets a value that indicates whether to maintain the crumb trail
     */
    trackCrumbTrail: boolean;
    /**
     * Gets the crumb trail key
     */
    crumbTrailKey: string;
    /**
     * Gets a value that indicates whether NavigationData Types are
     * preserved when navigating
     */
    trackTypes: boolean;
    /**
     * Gets the additional state attributes
     */
    [extras: string]: any;
    /**
     * Called on the old State before navigating to a different State
     * @param state The new State
     * @param data The new NavigationData
     * @param url The new target location
     * @param unload The function to call to continue to navigate
     * @param history A value indicating whether browser history was used
     */
    unloading: (state: State, data: any, url: string, unload: () => void, history?: boolean) => void;
    /**
     * Called on the old State after navigating to a different State
     */
    dispose: () => void;
    /**
     * Called on the current State after navigating to it
     * @param data The current NavigationData
     * @param asyncData The data passed asynchronously while navigating
     */
    navigated: (data: any, asyncData: any) => void;
    /**
     * Called on the new State before navigating to it
     * @param data The new NavigationData
     * @param url The new target location
     * @param navigate The function to call to continue to navigate
     * @param history A value indicating whether browser history was used
     */
    navigating: (data: any, url: string, navigate: (asyncData?: any) => void, history: boolean) => void;
    /**
     * Encodes the Url value
     * @param state The State navigated to
     * @param key The key of the navigation data item
     * @param val The Url value of the navigation data item
     * @param queryString A value indicating the Url value's location
     * @param index The index of the navigation data array item
     */
    urlEncode(state: State, key: string, val: string, queryString: boolean, index?: number): string;
    /**
     * Decodes the Url value
     * @param state The State navigated to
     * @param key The key of the navigation data item
     * @param val The Url value of the navigation data item
     * @param queryString A value indicating the Url value's location
     */
    urlDecode(state: State, key: string, val: string, queryString: boolean): string;
    /**
     * Validates the NavigationData before navigating to the new State
     * @param data The new NavigationData
     * @returns Validation success indicator
     */
    validate(data: any): boolean;
    /**
     * Truncates the crumb trail whenever a repeated or initial State is
     * encountered
     * @param The State navigated to
     * @param The new NavigationData
     * @param The Crumb collection representing the crumb trail
     * @returns Truncated crumb trail
     */
    truncateCrumbTrail(state: State, data: any, crumbs: Crumb[]): Crumb[];
}

/**
 * Defines a contract a class must implement in order to manage the browser
 * Url
 */
export interface HistoryManager {
    /**
     * Gets or sets a value indicating whether to disable browser history
     */
    disabled: boolean;
    /**
     * Registers browser history event listeners
     * @param navigateHistory The history navigation event handler
     */
    init(navigateHistory: (url?: string) => void): void;
    /**
     * Adds browser history
     * @param url The current url
     * @param replace A value indicating whether to replace the current
     * browser history entry
     */
    addHistory(url: string, replace: boolean): void;
    /**
     * Gets the current location
     */
    getCurrentUrl(): string;
    /**
     * Gets an Href from the url
     */
    getHref(url: string): string;
    /**
     * Gets a Url from the anchor or location
     */
    getUrl(hrefElement: HTMLAnchorElement | Location): string;
    /**
     * Removes browser history event listeners
     */
    stop(): void;
}

/**
 * Manages history using the browser Url's hash. If used in a browser
 * without the hashchange event or outside of a browser environment, then
 * history is disabled
 */
export class HashHistoryManager implements HistoryManager {
    /**
     * Gets or sets a value indicating whether to disable browser history.<commit_msg>Typed state context param in addhistory<commit_after>/**
 * Defines a contract a class must implement in order to configure a State
 */
export interface StateInfo {
    /**
     * Gets the unique key
     */
    key: string;
    /**
     * Gets the default NavigationData for this State
     */
    defaults?: any;
    /**
     * Gets the default NavigationData Types for  this State
     */
    defaultTypes?: any;
    /**
     * Gets the textual description of the state
     */
    title?: string;
    /**
     * Gets the route Url patterns
     */
    route?: string | string[];
    /**
     * Gets a value that indicates whether to maintain the crumb trail
     */
    trackCrumbTrail?: boolean | string;
    /**
     * Gets a value that indicates whether NavigationData Types are
     * preserved when navigating
     */
    trackTypes?: boolean;
    /**
     * Gets the additional state attributes
     */
    [extras: string]: any;
}

/**
 * Represents a view and is the destination of a navigation
 */
export class State implements StateInfo {
    /**
     * Gets the unique key
     */
    key: string;
    /**
     * Gets the default NavigationData for this State
     */
    defaults: any;
    /**
     * Gets the default NavigationData Types for  this State
     */
    defaultTypes: any;
    /**
     * Gets the formatted default NavigationData for this State
     */
    formattedDefaults: any;
    /**
     * Gets the formatted default array NavigationData for this State
     */
    formattedArrayDefaults: { [index: string]: string[]; };
    /**
     * Gets the textual description of the state
     */
    title: string;
    /**
     * Gets the route Url patterns
     */
    route: string | string[];
    /**
     * Gets a value that indicates whether to maintain the crumb trail
     */
    trackCrumbTrail: boolean;
    /**
     * Gets the crumb trail key
     */
    crumbTrailKey: string;
    /**
     * Gets a value that indicates whether NavigationData Types are
     * preserved when navigating
     */
    trackTypes: boolean;
    /**
     * Gets the additional state attributes
     */
    [extras: string]: any;
    /**
     * Called on the old State before navigating to a different State
     * @param state The new State
     * @param data The new NavigationData
     * @param url The new target location
     * @param unload The function to call to continue to navigate
     * @param history A value indicating whether browser history was used
     */
    unloading: (state: State, data: any, url: string, unload: () => void, history?: boolean) => void;
    /**
     * Called on the old State after navigating to a different State
     */
    dispose: () => void;
    /**
     * Called on the current State after navigating to it
     * @param data The current NavigationData
     * @param asyncData The data passed asynchronously while navigating
     */
    navigated: (data: any, asyncData: any) => void;
    /**
     * Called on the new State before navigating to it
     * @param data The new NavigationData
     * @param url The new target location
     * @param navigate The function to call to continue to navigate
     * @param history A value indicating whether browser history was used
     */
    navigating: (data: any, url: string, navigate: (asyncData?: any) => void, history: boolean) => void;
    /**
     * Encodes the Url value
     * @param state The State navigated to
     * @param key The key of the navigation data item
     * @param val The Url value of the navigation data item
     * @param queryString A value indicating the Url value's location
     * @param index The index of the navigation data array item
     */
    urlEncode(state: State, key: string, val: string, queryString: boolean, index?: number): string;
    /**
     * Decodes the Url value
     * @param state The State navigated to
     * @param key The key of the navigation data item
     * @param val The Url value of the navigation data item
     * @param queryString A value indicating the Url value's location
     */
    urlDecode(state: State, key: string, val: string, queryString: boolean): string;
    /**
     * Validates the NavigationData before navigating to the new State
     * @param data The new NavigationData
     * @returns Validation success indicator
     */
    validate(data: any): boolean;
    /**
     * Truncates the crumb trail whenever a repeated or initial State is
     * encountered
     * @param The State navigated to
     * @param The new NavigationData
     * @param The Crumb collection representing the crumb trail
     * @returns Truncated crumb trail
     */
    truncateCrumbTrail(state: State, data: any, crumbs: Crumb[]): Crumb[];
}

/**
 * Defines a contract a class must implement in order to manage the browser
 * Url
 */
export interface HistoryManager {
    /**
     * Gets or sets a value indicating whether to disable browser history
     */
    disabled: boolean;
    /**
     * Registers browser history event listeners
     * @param navigateHistory The history navigation event handler
     */
    init(navigateHistory: (url?: string) => void): void;
    /**
     * Adds browser history
     * @param url The current url
     * @param replace A value indicating whether to replace the current
     * @param stateContext The current StateContext
     * browser history entry
     */
    addHistory(url: string, replace: boolean, stateContext: StateContext): void;
    /**
     * Gets the current location
     */
    getCurrentUrl(): string;
    /**
     * Gets an Href from the url
     */
    getHref(url: string): string;
    /**
     * Gets a Url from the anchor or location
     */
    getUrl(hrefElement: HTMLAnchorElement | Location): string;
    /**
     * Removes browser history event listeners
     */
    stop(): void;
}

/**
 * Manages history using the browser Url's hash. If used in a browser
 * without the hashchange event or outside of a browser environment, then
 * history is disabled
 */
export class HashHistoryManager implements HistoryManager {
    /**
     * Gets or sets a value indicating whether to disable browser history.
{'fraction_non_alphanumeric': 0.08501891136326262, 'fraction_numerical': 0.0, 'mean_word_length': 2.4801144492131617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4933874', 'n_tokens_mistral': 3169, 'n_tokens_neox': 3103, 'n_words': 1381}