{"version":3,"file":"ptsecurity-cdk-a11y.mjs","sources":["../../../packages/cdk/a11y/key-manager/list-key-manager.ts","../../../packages/cdk/a11y/key-manager/activedescendant-key-manager.ts","../../../packages/cdk/a11y/key-manager/focus-key-manager.ts","../../../packages/cdk/a11y/ptsecurity-cdk-a11y.ts"],"sourcesContent":["import { QueryList } from '@angular/core';\nimport {\n    UP_ARROW,\n    DOWN_ARROW,\n    LEFT_ARROW,\n    RIGHT_ARROW,\n    TAB,\n    A,\n    Z,\n    ZERO,\n    NINE,\n    HOME,\n    END\n} from '@ptsecurity/cdk/keycodes';\nimport { Subject, Subscription } from 'rxjs';\nimport { debounceTime, filter, map, tap } from 'rxjs/operators';\n\n\n// This interface is for items that can be passed to a ListKeyManager.\nexport interface ListKeyManagerOption {\n    // Whether the option is disabled.\n    disabled?: boolean;\n\n    // Gets the label for this option.\n    getLabel?(): string;\n}\n\n/** Modifier keys handled by the ListKeyManager. */\nexport type ListKeyManagerModifierKey = 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey';\n\n/* tslint:disable:member-ordering */\n/**\n * This class manages keyboard events for selectable lists. If you pass it a query list\n * of items, it will set the active item correctly when arrow events occur.\n */\nexport class ListKeyManager<T extends ListKeyManagerOption> {\n    /**\n     * Stream that emits any time the TAB key is pressed, so components can react\n     * when focus is shifted off of the list.\n     */\n    tabOut: Subject<void> = new Subject<void>();\n\n    /** Stream that emits whenever the active item of the list manager changes. */\n    change = new Subject<number>();\n\n    previousActiveItemIndex = -1;\n\n    // Index of the currently active item.\n    get activeItemIndex(): number {\n        return this._activeItemIndex;\n    }\n\n    private _activeItemIndex = -1;\n\n    // The active item.\n    get activeItem(): T | null {\n        return this._activeItem;\n    }\n\n    private _activeItem: T;\n\n    private wrap: boolean = false;\n    private letterKeyStream = new Subject<string>();\n    private typeaheadSubscription = Subscription.EMPTY;\n    private vertical = true;\n    private horizontal: 'ltr' | 'rtl' | null;\n\n    private scrollSize: number = 0;\n\n    // Buffer for the letters that the user has pressed when the typeahead option is turned on.\n    private pressedLetters: string[] = [];\n\n    private homeAndEnd = false;\n\n    private allowedModifierKeys: ListKeyManagerModifierKey[] = [];\n\n    constructor(private _items: QueryList<T>) {\n        if (_items instanceof QueryList) {\n\n            _items.changes.subscribe((newItems: QueryList<T>) => {\n\n                if (this._activeItem) {\n                    const itemArray = newItems.toArray();\n                    const newIndex = itemArray.indexOf(this._activeItem);\n\n                    if (newIndex > -1 && newIndex !== this._activeItemIndex) {\n                        this._activeItemIndex = newIndex;\n                    }\n                }\n            });\n        }\n    }\n\n    /** Gets whether the user is currently typing into the manager using the typeahead feature. */\n    isTyping(): boolean {\n        return this.pressedLetters.length > 0;\n    }\n\n    withScrollSize(scrollSize: number): this {\n        this.scrollSize = scrollSize;\n\n        return this;\n    }\n\n    /**\n     * Modifier keys which are allowed to be held down and whose default actions will be prevented\n     * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.\n     */\n    withAllowedModifierKeys(keys: ListKeyManagerModifierKey[]): this {\n        this.allowedModifierKeys = keys;\n\n        return this;\n    }\n\n    /**\n     * Turns on wrapping mode, which ensures that the active item will wrap to\n     * the other end of list when there are no more items in the given direction.\n     */\n\n    withWrap(shouldWrap = true): this {\n        this.wrap = shouldWrap;\n\n        return this;\n    }\n\n    /**\n     * Sets the predicate function that determines which items should be skipped by the\n     * list key manager.\n     * @param predicate Function that determines whether the given item should be skipped.\n     */\n    skipPredicate(predicate: (item: T) => boolean): this {\n        this.skipPredicateFn = predicate;\n\n        return this;\n    }\n\n    /**\n     * Configures whether the key manager should be able to move the selection vertically.\n     * @param enabled Whether vertical selection should be enabled.\n     */\n    withVerticalOrientation(enabled: boolean = true): this {\n        this.vertical = enabled;\n\n        return this;\n    }\n\n    /**\n     * Configures the key manager to move the selection horizontally.\n     * Passing in `null` will disable horizontal movement.\n     * @param direction Direction in which the selection can be moved.\n     */\n    withHorizontalOrientation(direction: 'ltr' | 'rtl' | null): this {\n        this.horizontal = direction;\n\n        return this;\n    }\n\n    /**\n     * Turns on typeahead mode which allows users to set the active item by typing.\n     * @param searchLetterIndex letter index for incremental search, if is -1 search is disabled\n     * @param debounceInterval Time to wait after the last keystroke before setting the active item.\n     */\n    withTypeAhead(debounceInterval: number = 200, searchLetterIndex: number = 0): this {\n        if (this._items.length && this._items.some((item) => typeof item.getLabel !== 'function')) {\n            throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.');\n        }\n\n        this.typeaheadSubscription.unsubscribe();\n\n        // Debounce the presses of non-navigational keys, collect the ones that correspond to letters and convert those\n        // letters back into a string. Afterwards find the first item that starts with that string and select it.\n        this.typeaheadSubscription = this.letterKeyStream.pipe(\n            tap((keyCode) => this.pressedLetters.push(keyCode)),\n            debounceTime(debounceInterval),\n            filter(() => this.pressedLetters.length > 0),\n            map(() => this.pressedLetters.join(''))\n        ).subscribe((inputString) => {\n            if (searchLetterIndex === -1) {\n                this.pressedLetters = [];\n\n                return;\n            }\n\n            const items = this._items.toArray();\n\n            // Start at 1 because we want to start searching at the item immediately\n            // following the current active item.\n            for (let i = 1; i < items.length + 1; i++) {\n                const index = (this._activeItemIndex + i) % items.length;\n                const item = items[index];\n\n                if (\n                    !item.disabled &&\n                    item.getLabel!().toUpperCase().trim().indexOf(inputString) === searchLetterIndex\n                ) {\n                    this.setActiveItem(index);\n                    break;\n                }\n            }\n\n            this.pressedLetters = [];\n        });\n\n        return this;\n    }\n\n    /**\n     * Configures the key manager to activate the first and last items\n     * respectively when the Home or End key is pressed.\n     * @param enabled Whether pressing the Home or End key activates the first/last item.\n     */\n    withHomeAndEnd(enabled: boolean = true): this {\n        this.homeAndEnd = enabled;\n\n        return this;\n    }\n\n    /**\n     * Sets the active item to the item at the index specified.\n     * @param index The index of the item to be set as active or item The item to be set as active.\n     */\n    setActiveItem(index: number | T): void;\n\n    /**\n     * Sets the active item to the item at the index specified.\n     * @param item The index of the item to be set as active.\n     */\n    setActiveItem(item: any): void {\n        this.previousActiveItemIndex = this._activeItemIndex;\n\n        this.updateActiveItem(item);\n\n        if (this._activeItemIndex !== this.previousActiveItemIndex) {\n            this.change.next(this._activeItemIndex);\n        }\n    }\n\n    /**\n     * Sets the active item depending on the key event passed in.\n     * @param event Keyboard event to be used for determining which element should be active.\n     */\n    // tslint:disable-next-line:cyclomatic-complexity\n    onKeydown(event: KeyboardEvent): void {\n        // tslint:disable-next-line: deprecation\n        const keyCode = event.keyCode;\n\n        const modifiers: ListKeyManagerModifierKey[] = ['altKey', 'ctrlKey', 'metaKey', 'shiftKey'];\n        const isModifierAllowed = modifiers.every((modifier) => {\n            return !event[modifier] || this.allowedModifierKeys.indexOf(modifier) > -1;\n        });\n\n        switch (keyCode) {\n            case TAB:\n                this.tabOut.next();\n\n                return;\n\n            case DOWN_ARROW:\n                if (this.vertical) {\n                    this.setNextItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case UP_ARROW:\n                if (this.vertical) {\n                    this.setPreviousItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case RIGHT_ARROW:\n                if (this.horizontal === 'ltr') {\n                    this.setNextItemActive();\n                    break;\n                } else if (this.horizontal === 'rtl') {\n                    this.setPreviousItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case LEFT_ARROW:\n                if (this.horizontal === 'ltr') {\n                    this.setPreviousItemActive();\n                    break;\n                } else if (this.horizontal === 'rtl') {\n                    this.setNextItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case HOME:\n                if (this.homeAndEnd && isModifierAllowed) {\n                    this.setFirstItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case END:\n                if (this.homeAndEnd && isModifierAllowed) {\n                    this.setLastItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            default:\n                // Attempt to use the `event.key` which also maps it to the user's keyboard language,\n                // otherwise fall back to resolving alphanumeric characters via the keyCode.\n                if (event.key && event.key.length === 1) {\n                    this.letterKeyStream.next(event.key.toLocaleUpperCase());\n                } else if ((keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE)) {\n                    this.letterKeyStream.next(String.fromCharCode(keyCode));\n                }\n\n                // Note that we return here, in order to avoid preventing\n                // the default action of non-navigational keys.\n                return;\n        }\n\n        this.pressedLetters = [];\n        event.preventDefault();\n    }\n\n    // Sets the active item to the first enabled item in the list.\n    setFirstItemActive(): void {\n        this.setActiveItemByIndex(0, 1);\n    }\n\n    // Sets the active item to the last enabled item in the list.\n    setLastItemActive(): void {\n        this.setActiveItemByIndex(this._items.length - 1, -1);\n    }\n\n    // Sets the active item to the next enabled item in the list.\n    setNextItemActive(): void {\n        this._activeItemIndex < 0 ? this.setFirstItemActive() : this.setActiveItemByDelta(1);\n    }\n\n    // Sets the active item to a previous enabled item in the list.\n    setPreviousItemActive(): void {\n        this._activeItemIndex < 0 && this.wrap ? this.setLastItemActive()\n            : this.setActiveItemByDelta(-1);\n    }\n\n    setNextPageItemActive(delta: number = this.scrollSize): void {\n        const nextItemIndex = this._activeItemIndex + delta;\n\n        if (nextItemIndex >= this._items.length) {\n            this.setLastItemActive();\n        } else {\n            this.setActiveItemByDelta(delta);\n        }\n    }\n\n    setPreviousPageItemActive(delta: number = this.scrollSize): void {\n        const nextItemIndex = this._activeItemIndex - delta;\n\n        if (nextItemIndex <= 0) {\n            this.setFirstItemActive();\n        } else {\n            this.setActiveItemByDelta(-delta);\n        }\n    }\n\n    /**\n     * Allows setting the active without any other effects.\n     * @param index Index of the item to be set as active.\n     */\n    updateActiveItem(index: number): void;\n\n    /**\n     * Allows setting the active item without any other effects.\n     * @param item Item to be set as active or index Index of the item to be set as active..\n     */\n    // tslint:disable-next-line:unified-signatures\n    updateActiveItem(item: number | T): void;\n\n    updateActiveItem(item: any): void {\n        const itemArray = this._items.toArray();\n        const index = typeof item === 'number' ? item : itemArray.indexOf(item);\n\n        this._activeItemIndex = index;\n        this._activeItem = itemArray[index];\n    }\n\n    /**\n     * Predicate function that can be used to check whether an item should be skipped\n     * by the key manager. By default, disabled items are skipped.\n     */\n    private skipPredicateFn = (item: T) => item.disabled;\n\n    /**\n     * This method sets the active item, given a list of items and the delta between the\n     * currently active item and the new active item. It will calculate differently\n     * depending on whether wrap mode is turned on.\n     */\n    private setActiveItemByDelta(delta: number): void {\n        this.wrap ? this.setActiveInWrapMode(delta) : this.setActiveInDefaultMode(delta);\n    }\n\n    /**\n     * Sets the active item properly given \"wrap\" mode. In other words, it will continue to move\n     * down the list until it finds an item that is not disabled, and it will wrap if it\n     * encounters either end of the list.\n     */\n    private setActiveInWrapMode(delta: number): void {\n        const items = this.getItemsArray();\n\n        for (let i = 1; i <= items.length; i++) {\n            const index = (this._activeItemIndex + (delta * i) + items.length) % items.length;\n            const item = items[index];\n\n            if (!this.skipPredicateFn(item)) {\n                this.setActiveItem(index);\n\n                return;\n            }\n        }\n    }\n\n    /**\n     * Sets the active item properly given the default mode. In other words, it will\n     * continue to move down the list until it finds an item that is not disabled. If\n     * it encounters either end of the list, it will stop and not wrap.\n     */\n    private setActiveInDefaultMode(delta: number): void {\n        this.setActiveItemByIndex(this._activeItemIndex + delta, delta);\n    }\n\n    /**\n     * Sets the active item to the first enabled item starting at the index specified. If the\n     * item is disabled, it will move in the fallbackDelta direction until it either\n     * finds an enabled item or encounters the end of the list.\n     */\n    private setActiveItemByIndex(index: number, fallbackDelta: number): void {\n        const items = this.getItemsArray();\n\n        if (!items[index]) { return; }\n\n        let curIndex = index;\n        while (this.skipPredicateFn(items[curIndex])) {\n            curIndex += fallbackDelta;\n\n            if (!items[curIndex]) { return; }\n        }\n\n        this.setActiveItem(curIndex);\n    }\n\n    /** Returns the items as an array. */\n    private getItemsArray(): T[] {\n        return this._items instanceof QueryList ? this._items.toArray() : this._items;\n    }\n}\n\n/* tslint:enable:member-ordering */\n","\nimport { ListKeyManager, ListKeyManagerOption } from './list-key-manager';\n\n\n/**\n * This is the interface for highlightable items (used by the ActiveDescendantKeyManager).\n * Each item must know how to style itself as active or inactive and whether or not it is\n * currently disabled.\n */\nexport interface Highlightable extends ListKeyManagerOption {\n    // Applies the styles for an active item to this item.\n    setActiveStyles(): void;\n\n    // Applies the styles for an inactive item to this item.\n    setInactiveStyles(): void;\n}\n\nexport class ActiveDescendantKeyManager<T> extends ListKeyManager<Highlightable & T> {\n\n    /**\n     * Sets the active item to the item at the specified index and adds the\n     * active styles to the newly active item. Also removes active styles\n     * from the previously active item.\n     * @param index Index of the item to be set as active.\n     */\n    setActiveItem(index: number): void;\n\n    /**\n     * Sets the active item to the item to the specified one and adds the\n     * active styles to the it. Also removes active styles from the\n     * previously active item.\n     * @param item Item to be set as active.\n     */\n    setActiveItem(item: T): void;\n\n    /**\n     * This method sets the active item to the item at the specified index.\n     * It also adds active styles to the newly active item and removes active\n     * styles from the previously active item.\n     */\n    setActiveItem(index: any): void {\n        if (this.activeItem) {\n            this.activeItem.setInactiveStyles();\n        }\n\n        super.setActiveItem(index);\n\n        if (this.activeItem) {\n            this.activeItem.setActiveStyles();\n        }\n    }\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\n\nimport { ListKeyManager, ListKeyManagerOption } from './list-key-manager';\n\n\n/**\n * This is the interface for focusable items (used by the FocusKeyManager).\n * Each item must know how to focus itself, whether or not it is currently disabled\n * and be able to supply it's label.\n */\nexport interface IFocusableOption extends ListKeyManagerOption {\n    // Focuses the `FocusableOption`. */\n    focus(origin?: FocusOrigin): void;\n}\n\nexport class FocusKeyManager<T> extends ListKeyManager<IFocusableOption & T> {\n    private origin: FocusOrigin = 'program';\n\n    /**\n     * Sets the active item or index to the item that is specified and focuses it.\n     * @param item Item to be set as active.\n     */\n    setActiveItem(item: number | T): void;\n\n    setActiveItem(item: any): void {\n        super.setActiveItem(item);\n\n        if (this.activeItem) {\n            this.activeItem.focus(this.origin);\n        }\n    }\n\n    /**\n     * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.\n     * @param origin Focus origin to be used when focusing items.\n     */\n    setFocusOrigin(origin: FocusOrigin): this {\n        this.origin = origin;\n\n        return this;\n    }\n\n    getFocusOrigin(): FocusOrigin {\n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