blob: 591bbca10e335a170af3252ca6abb21c014dde7e [file] [log] [blame]
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("@angular/core"),require("rxjs"),require("@angular/cdk/keycodes"),require("rxjs/operators"),require("@angular/cdk/platform"),require("@angular/cdk/coercion"),require("@angular/cdk/observers")):"function"==typeof define&&define.amd?define("@angular/cdk/a11y",["exports","@angular/common","@angular/core","rxjs","@angular/cdk/keycodes","rxjs/operators","@angular/cdk/platform","@angular/cdk/coercion","@angular/cdk/observers"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.a11y={}),e.ng.common,e.ng.core,e.rxjs,e.ng.cdk.keycodes,e.rxjs.operators,e.ng.cdk.platform,e.ng.cdk.coercion,e.ng.cdk.observers)}(this,function(e,t,n,r,i,o,s,c,u){"use strict";function a(e,t){function n(){this.constructor=e}L(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function d(e,t,n){var r=h(e,t);r.some(function(e){return e.trim()==n.trim()})||(r.push(n.trim()),e.setAttribute(t,r.join(F)))}function l(e,t,n){var r=h(e,t),i=r.filter(function(e){return e!=n.trim()});e.setAttribute(t,i.join(F))}function h(e,t){return(e.getAttribute(t)||"").match(/\S+/g)||[]}function p(e,t){return e||new D(t)}function f(e){try{return e.frameElement}catch(e){return null}}function _(e){return!!(e.offsetWidth||e.offsetHeight||"function"==typeof e.getClientRects&&e.getClientRects().length)}function m(e){var t=e.nodeName.toLowerCase();return"input"===t||"select"===t||"button"===t||"textarea"===t}function b(e){return v(e)&&"hidden"==e.type}function y(e){return g(e)&&e.hasAttribute("href")}function v(e){return"input"==e.nodeName.toLowerCase()}function g(e){return"a"==e.nodeName.toLowerCase()}function I(e){if(!e.hasAttribute("tabindex")||void 0===e.tabIndex)return!1;var t=e.getAttribute("tabindex");return"-32768"!=t&&!(!t||isNaN(parseInt(t,10)))}function E(e){if(!I(e))return null;var t=parseInt(e.getAttribute("tabindex")||"",10);return isNaN(t)?-1:t}function A(e){var t=e.nodeName.toLowerCase(),n="input"===t&&e.type;return"text"===n||"password"===n||"select"===t||"textarea"===t}function T(e){return!b(e)&&(m(e)||y(e)||e.hasAttribute("contenteditable")||I(e))}function k(e){return e.ownerDocument&&e.ownerDocument.defaultView||window}function O(){return null}function C(e,t,n,r){return e||new z(t,r,n)}function w(e,t,n){return e||new X(t,n)}function N(e){return 0===e.buttons}var L=function(e,t){return(L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},F=" ",M=0,R=new Map,x=null,D=function(){function e(e){this._document=e}return e.prototype.describe=function(e,t){this._canBeDescribed(e,t)&&("string"!=typeof t?(this._setMessageId(t),R.set(t,{messageElement:t,referenceCount:0})):R.has(t)||this._createMessageElement(t),this._isElementDescribedByMessage(e,t)||this._addMessageReference(e,t))},e.prototype.removeDescription=function(e,t){if(this._isElementNode(e)){if(this._isElementDescribedByMessage(e,t)&&this._removeMessageReference(e,t),"string"==typeof t){var n=R.get(t);n&&0===n.referenceCount&&this._deleteMessageElement(t)}x&&0===x.childNodes.length&&this._deleteMessagesContainer()}},e.prototype.ngOnDestroy=function(){for(var e=this._document.querySelectorAll("[cdk-describedby-host]"),t=0;t<e.length;t++)this._removeCdkDescribedByReferenceIds(e[t]),e[t].removeAttribute("cdk-describedby-host");x&&this._deleteMessagesContainer(),R.clear()},e.prototype._createMessageElement=function(e){var t=this._document.createElement("div");this._setMessageId(t),t.textContent=e,this._createMessagesContainer(),x.appendChild(t),R.set(e,{messageElement:t,referenceCount:0})},e.prototype._setMessageId=function(e){e.id||(e.id="cdk-describedby-message-"+M++)},e.prototype._deleteMessageElement=function(e){var t=R.get(e),n=t&&t.messageElement;x&&n&&x.removeChild(n),R.delete(e)},e.prototype._createMessagesContainer=function(){if(!x){var e=this._document.getElementById("cdk-describedby-message-container");e&&e.parentNode.removeChild(e),x=this._document.createElement("div"),x.id="cdk-describedby-message-container",x.setAttribute("aria-hidden","true"),x.style.display="none",this._document.body.appendChild(x)}},e.prototype._deleteMessagesContainer=function(){x&&x.parentNode&&(x.parentNode.removeChild(x),x=null)},e.prototype._removeCdkDescribedByReferenceIds=function(e){var t=h(e,"aria-describedby").filter(function(e){return 0!=e.indexOf("cdk-describedby-message")});e.setAttribute("aria-describedby",t.join(" "))},e.prototype._addMessageReference=function(e,t){var n=R.get(t);d(e,"aria-describedby",n.messageElement.id),e.setAttribute("cdk-describedby-host",""),n.referenceCount++},e.prototype._removeMessageReference=function(e,t){var n=R.get(t);n.referenceCount--,l(e,"aria-describedby",n.messageElement.id),e.removeAttribute("cdk-describedby-host")},e.prototype._isElementDescribedByMessage=function(e,t){var n=h(e,"aria-describedby"),r=R.get(t),i=r&&r.messageElement.id;return!!i&&-1!=n.indexOf(i)},e.prototype._canBeDescribed=function(e,t){if(!this._isElementNode(e))return!1;if(t&&"object"==typeof t)return!0;var n=null==t?"":(""+t).trim(),r=e.getAttribute("aria-label");return!!n&&(!r||r.trim()!==n)},e.prototype._isElementNode=function(e){return e.nodeType===this._document.ELEMENT_NODE},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:void 0,decorators:[{type:n.Inject,args:[t.DOCUMENT]}]}]},e.ngInjectableDef=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(t.DOCUMENT))},token:e,providedIn:"root"}),e}(),j={provide:D,deps:[[new n.Optional,new n.SkipSelf,D],t.DOCUMENT],useFactory:p},S=function(){function e(e){var t=this;this._items=e,this._activeItemIndex=-1,this._activeItem=null,this._wrap=!1,this._letterKeyStream=new r.Subject,this._typeaheadSubscription=r.Subscription.EMPTY,this._vertical=!0,this._allowedModifierKeys=[],this._skipPredicateFn=function(e){return e.disabled},this._pressedLetters=[],this.tabOut=new r.Subject,this.change=new r.Subject,e instanceof n.QueryList&&e.changes.subscribe(function(e){if(t._activeItem){var n=e.toArray(),r=n.indexOf(t._activeItem);r>-1&&r!==t._activeItemIndex&&(t._activeItemIndex=r)}})}return e.prototype.skipPredicate=function(e){return this._skipPredicateFn=e,this},e.prototype.withWrap=function(e){return void 0===e&&(e=!0),this._wrap=e,this},e.prototype.withVerticalOrientation=function(e){return void 0===e&&(e=!0),this._vertical=e,this},e.prototype.withHorizontalOrientation=function(e){return this._horizontal=e,this},e.prototype.withAllowedModifierKeys=function(e){return this._allowedModifierKeys=e,this},e.prototype.withTypeAhead=function(e){var t=this;if(void 0===e&&(e=200),this._items.length&&this._items.some(function(e){return"function"!=typeof e.getLabel}))throw Error("ListKeyManager items in typeahead mode must implement the `getLabel` method.");return this._typeaheadSubscription.unsubscribe(),this._typeaheadSubscription=this._letterKeyStream.pipe(o.tap(function(e){return t._pressedLetters.push(e)}),o.debounceTime(e),o.filter(function(){return t._pressedLetters.length>0}),o.map(function(){return t._pressedLetters.join("")})).subscribe(function(e){for(var n=t._getItemsArray(),r=1;r<n.length+1;r++){var i=(t._activeItemIndex+r)%n.length,o=n[i];if(!t._skipPredicateFn(o)&&0===o.getLabel().toUpperCase().trim().indexOf(e)){t.setActiveItem(i);break}}t._pressedLetters=[]}),this},e.prototype.setActiveItem=function(e){var t=this._activeItemIndex;this.updateActiveItem(e),this._activeItemIndex!==t&&this.change.next(this._activeItemIndex)},e.prototype.onKeydown=function(e){var t=this,n=e.keyCode,r=["altKey","ctrlKey","metaKey","shiftKey"],o=r.every(function(n){return!e[n]||t._allowedModifierKeys.indexOf(n)>-1});switch(n){case i.TAB:return void this.tabOut.next();case i.DOWN_ARROW:if(this._vertical&&o){this.setNextItemActive();break}return;case i.UP_ARROW:if(this._vertical&&o){this.setPreviousItemActive();break}return;case i.RIGHT_ARROW:if(this._horizontal&&o){"rtl"===this._horizontal?this.setPreviousItemActive():this.setNextItemActive();break}return;case i.LEFT_ARROW:if(this._horizontal&&o){"rtl"===this._horizontal?this.setNextItemActive():this.setPreviousItemActive();break}return;default:return void((o||i.hasModifierKey(e,"shiftKey"))&&(e.key&&1===e.key.length?this._letterKeyStream.next(e.key.toLocaleUpperCase()):(n>=i.A&&n<=i.Z||n>=i.ZERO&&n<=i.NINE)&&this._letterKeyStream.next(String.fromCharCode(n))))}this._pressedLetters=[],e.preventDefault()},Object.defineProperty(e.prototype,"activeItemIndex",{get:function(){return this._activeItemIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this._activeItem},enumerable:!0,configurable:!0}),e.prototype.setFirstItemActive=function(){this._setActiveItemByIndex(0,1)},e.prototype.setLastItemActive=function(){this._setActiveItemByIndex(this._items.length-1,-1)},e.prototype.setNextItemActive=function(){this._activeItemIndex<0?this.setFirstItemActive():this._setActiveItemByDelta(1)},e.prototype.setPreviousItemActive=function(){this._activeItemIndex<0&&this._wrap?this.setLastItemActive():this._setActiveItemByDelta(-1)},e.prototype.updateActiveItem=function(e){var t=this._getItemsArray(),n="number"==typeof e?e:t.indexOf(e),r=t[n];this._activeItem=null==r?null:r,this._activeItemIndex=n},e.prototype.updateActiveItemIndex=function(e){this.updateActiveItem(e)},e.prototype._setActiveItemByDelta=function(e){this._wrap?this._setActiveInWrapMode(e):this._setActiveInDefaultMode(e)},e.prototype._setActiveInWrapMode=function(e){for(var t=this._getItemsArray(),n=1;n<=t.length;n++){var r=(this._activeItemIndex+e*n+t.length)%t.length,i=t[r];if(!this._skipPredicateFn(i))return void this.setActiveItem(r)}},e.prototype._setActiveInDefaultMode=function(e){this._setActiveItemByIndex(this._activeItemIndex+e,e)},e.prototype._setActiveItemByIndex=function(e,t){var n=this._getItemsArray();if(n[e]){for(;this._skipPredicateFn(n[e]);)if(e+=t,!n[e])return;this.setActiveItem(e)}},e.prototype._getItemsArray=function(){return this._items instanceof n.QueryList?this._items.toArray():this._items},e}(),P=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.setActiveItem=function(t){this.activeItem&&this.activeItem.setInactiveStyles(),e.prototype.setActiveItem.call(this,t),this.activeItem&&this.activeItem.setActiveStyles()},t}(S),B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._origin="program",t}return a(t,e),t.prototype.setFocusOrigin=function(e){return this._origin=e,this},t.prototype.setActiveItem=function(t){e.prototype.setActiveItem.call(this,t),this.activeItem&&this.activeItem.focus(this._origin)},t}(S),K=function(){function e(e){this._platform=e}return e.prototype.isDisabled=function(e){return e.hasAttribute("disabled")},e.prototype.isVisible=function(e){return _(e)&&"visible"===getComputedStyle(e).visibility},e.prototype.isTabbable=function(e){if(!this._platform.isBrowser)return!1;var t=f(k(e));if(t){var n=t&&t.nodeName.toLowerCase();if(-1===E(t))return!1;if((this._platform.BLINK||this._platform.WEBKIT)&&"object"===n)return!1;if((this._platform.BLINK||this._platform.WEBKIT)&&!this.isVisible(t))return!1}var r=e.nodeName.toLowerCase(),i=E(e);if(e.hasAttribute("contenteditable"))return-1!==i;if("iframe"===r)return!1;if("audio"===r){if(!e.hasAttribute("controls"))return!1;if(this._platform.BLINK)return!0}if("video"===r){if(!e.hasAttribute("controls")&&this._platform.TRIDENT)return!1;if(this._platform.BLINK||this._platform.FIREFOX)return!0}return("object"!==r||!this._platform.BLINK&&!this._platform.WEBKIT)&&(!(this._platform.WEBKIT&&this._platform.IOS&&!A(e))&&e.tabIndex>=0)},e.prototype.isFocusable=function(e){return T(e)&&!this.isDisabled(e)&&this.isVisible(e)},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:s.Platform}]},e.ngInjectableDef=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(s.Platform))},token:e,providedIn:"root"}),e}(),Z=function(){function e(e,t,n,r,i){var o=this;void 0===i&&(i=!1),this._element=e,this._checker=t,this._ngZone=n,this._document=r,this._hasAttached=!1,this.startAnchorListener=function(){return o.focusLastTabbableElement()},this.endAnchorListener=function(){return o.focusFirstTabbableElement()},this._enabled=!0,i||this.attachAnchors()}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e,this._startAnchor&&this._endAnchor&&(this._toggleAnchorTabIndex(e,this._startAnchor),this._toggleAnchorTabIndex(e,this._endAnchor))},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){var e=this._startAnchor,t=this._endAnchor;e&&(e.removeEventListener("focus",this.startAnchorListener),e.parentNode&&e.parentNode.removeChild(e)),t&&(t.removeEventListener("focus",this.endAnchorListener),t.parentNode&&t.parentNode.removeChild(t)),this._startAnchor=this._endAnchor=null},e.prototype.attachAnchors=function(){var e=this;return!!this._hasAttached||(this._ngZone.runOutsideAngular(function(){e._startAnchor||(e._startAnchor=e._createAnchor(),e._startAnchor.addEventListener("focus",e.startAnchorListener)),e._endAnchor||(e._endAnchor=e._createAnchor(),e._endAnchor.addEventListener("focus",e.endAnchorListener))}),this._element.parentNode&&(this._element.parentNode.insertBefore(this._startAnchor,this._element),this._element.parentNode.insertBefore(this._endAnchor,this._element.nextSibling),this._hasAttached=!0),this._hasAttached)},e.prototype.focusInitialElementWhenReady=function(){var e=this;return new Promise(function(t){e._executeOnStable(function(){return t(e.focusInitialElement())})})},e.prototype.focusFirstTabbableElementWhenReady=function(){var e=this;return new Promise(function(t){e._executeOnStable(function(){return t(e.focusFirstTabbableElement())})})},e.prototype.focusLastTabbableElementWhenReady=function(){var e=this;return new Promise(function(t){e._executeOnStable(function(){return t(e.focusLastTabbableElement())})})},e.prototype._getRegionBoundary=function(e){for(var t=this._element.querySelectorAll("[cdk-focus-region-"+e+"], [cdkFocusRegion"+e+"], [cdk-focus-"+e+"]"),n=0;n<t.length;n++)t[n].hasAttribute("cdk-focus-"+e)?console.warn("Found use of deprecated attribute 'cdk-focus-"+e+"', use 'cdkFocusRegion"+e+"' instead. The deprecated attribute will be removed in 8.0.0.",t[n]):t[n].hasAttribute("cdk-focus-region-"+e)&&console.warn("Found use of deprecated attribute 'cdk-focus-region-"+e+"', use 'cdkFocusRegion"+e+"' instead. The deprecated attribute will be removed in 8.0.0.",t[n]);return"start"==e?t.length?t[0]:this._getFirstTabbableElement(this._element):t.length?t[t.length-1]:this._getLastTabbableElement(this._element)},e.prototype.focusInitialElement=function(){var e=this._element.querySelector("[cdk-focus-initial], [cdkFocusInitial]");return e?(e.hasAttribute("cdk-focus-initial")&&console.warn("Found use of deprecated attribute 'cdk-focus-initial', use 'cdkFocusInitial' instead. The deprecated attribute will be removed in 8.0.0",e),n.isDevMode()&&!this._checker.isFocusable(e)&&console.warn("Element matching '[cdkFocusInitial]' is not focusable.",e),e.focus(),!0):this.focusFirstTabbableElement()},e.prototype.focusFirstTabbableElement=function(){var e=this._getRegionBoundary("start");return e&&e.focus(),!!e},e.prototype.focusLastTabbableElement=function(){var e=this._getRegionBoundary("end");return e&&e.focus(),!!e},e.prototype.hasAttached=function(){return this._hasAttached},e.prototype._getFirstTabbableElement=function(e){if(this._checker.isFocusable(e)&&this._checker.isTabbable(e))return e;for(var t=e.children||e.childNodes,n=0;n<t.length;n++){var r=t[n].nodeType===this._document.ELEMENT_NODE?this._getFirstTabbableElement(t[n]):null;if(r)return r}return null},e.prototype._getLastTabbableElement=function(e){if(this._checker.isFocusable(e)&&this._checker.isTabbable(e))return e;for(var t=e.children||e.childNodes,n=t.length-1;n>=0;n--){var r=t[n].nodeType===this._document.ELEMENT_NODE?this._getLastTabbableElement(t[n]):null;if(r)return r}return null},e.prototype._createAnchor=function(){var e=this._document.createElement("div");return this._toggleAnchorTabIndex(this._enabled,e),e.classList.add("cdk-visually-hidden"),e.classList.add("cdk-focus-trap-anchor"),e.setAttribute("aria-hidden","true"),e},e.prototype._toggleAnchorTabIndex=function(e,t){e?t.setAttribute("tabindex","0"):t.removeAttribute("tabindex")},e.prototype._executeOnStable=function(e){this._ngZone.isStable?e():this._ngZone.onStable.asObservable().pipe(o.take(1)).subscribe(e)},e}(),U=function(){function e(e,t,n){this._checker=e,this._ngZone=t,this._document=n}return e.prototype.create=function(e,t){return void 0===t&&(t=!1),new Z(e,this._checker,this._ngZone,this._document,t)},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:K},{type:n.NgZone},{type:void 0,decorators:[{type:n.Inject,args:[t.DOCUMENT]}]}]},e.ngInjectableDef=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(K),n.ɵɵinject(n.NgZone),n.ɵɵinject(t.DOCUMENT))},token:e,providedIn:"root"}),e}(),V=function(){function e(e,t,n){this._elementRef=e,this._focusTrapFactory=t,this._previouslyFocusedElement=null,this._document=n,this.focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement,!0)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this.focusTrap.enabled},set:function(e){this.focusTrap.enabled=c.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoCapture",{get:function(){return this._autoCapture},set:function(e){this._autoCapture=c.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this.focusTrap.destroy(),this._previouslyFocusedElement&&(this._previouslyFocusedElement.focus(),this._previouslyFocusedElement=null)},e.prototype.ngAfterContentInit=function(){this.focusTrap.attachAnchors(),this.autoCapture&&(this._previouslyFocusedElement=this._document.activeElement,this.focusTrap.focusInitialElementWhenReady())},e.prototype.ngDoCheck=function(){this.focusTrap.hasAttached()||this.focusTrap.attachAnchors()},e.decorators=[{type:n.Directive,args:[{selector:"[cdkTrapFocus]",exportAs:"cdkTrapFocus"}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:U},{type:void 0,decorators:[{type:n.Inject,args:[t.DOCUMENT]}]}]},e.propDecorators={enabled:[{type:n.Input,args:["cdkTrapFocus"]}],autoCapture:[{type:n.Input,args:["cdkTrapFocusAutoCapture"]}]},e}(),W=new n.InjectionToken("liveAnnouncerElement",{providedIn:"root",factory:O}),q=new n.InjectionToken("LIVE_ANNOUNCER_DEFAULT_OPTIONS"),z=function(){function e(e,t,n,r){this._ngZone=t,this._defaultOptions=r,this._document=n,this._liveElement=e||this._createLiveElement()}return e.prototype.announce=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i,o,s=this._defaultOptions;return 1===n.length&&"number"==typeof n[0]?o=n[0]:(i=n[0],o=n[1]),this.clear(),clearTimeout(this._previousTimeout),i||(i=s&&s.politeness?s.politeness:"polite"),null==o&&s&&(o=s.duration),this._liveElement.setAttribute("aria-live",i),this._ngZone.runOutsideAngular(function(){return new Promise(function(n){clearTimeout(t._previousTimeout),t._previousTimeout=setTimeout(function(){t._liveElement.textContent=e,n(),"number"==typeof o&&(t._previousTimeout=setTimeout(function(){return t.clear()},o))},100)})})},e.prototype.clear=function(){this._liveElement&&(this._liveElement.textContent="")},e.prototype.ngOnDestroy=function(){clearTimeout(this._previousTimeout),this._liveElement&&this._liveElement.parentNode&&(this._liveElement.parentNode.removeChild(this._liveElement),this._liveElement=null)},e.prototype._createLiveElement=function(){for(var e=this._document.getElementsByClassName("cdk-live-announcer-element"),t=this._document.createElement("div"),n=0;n<e.length;n++)e[n].parentNode.removeChild(e[n]);return t.classList.add("cdk-live-announcer-element"),t.classList.add("cdk-visually-hidden"),t.setAttribute("aria-atomic","true"),t.setAttribute("aria-live","polite"),this._document.body.appendChild(t),t},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:void 0,decorators:[{type:n.Optional},{type:n.Inject,args:[W]}]},{type:n.NgZone},{type:void 0,decorators:[{type:n.Inject,args:[t.DOCUMENT]}]},{type:void 0,decorators:[{type:n.Optional},{type:n.Inject,args:[q]}]}]},e.ngInjectableDef=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(W,8),n.ɵɵinject(n.NgZone),n.ɵɵinject(t.DOCUMENT),n.ɵɵinject(q,8))},token:e,providedIn:"root"}),e}(),Y=function(){function e(e,t,n,r){this._elementRef=e,this._liveAnnouncer=t,this._contentObserver=n,this._ngZone=r,this._politeness="off"}return Object.defineProperty(e.prototype,"politeness",{get:function(){return this._politeness},set:function(e){var t=this;this._politeness="polite"===e||"assertive"===e?e:"off","off"===this._politeness?this._subscription&&(this._subscription.unsubscribe(),this._subscription=null):this._subscription||(this._subscription=this._ngZone.runOutsideAngular(function(){return t._contentObserver.observe(t._elementRef).subscribe(function(){var e=t._elementRef.nativeElement.textContent;e!==t._previousAnnouncedText&&(t._liveAnnouncer.announce(e,t._politeness),t._previousAnnouncedText=e)})}))},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this._subscription&&this._subscription.unsubscribe()},e.decorators=[{type:n.Directive,args:[{selector:"[cdkAriaLive]",exportAs:"cdkAriaLive"}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:z},{type:u.ContentObserver},{type:n.NgZone}]},e.propDecorators={politeness:[{type:n.Input,args:["cdkAriaLive"]}]},e}(),Q={provide:z,deps:[[new n.Optional,new n.SkipSelf,z],[new n.Optional,new n.Inject(W)],t.DOCUMENT,n.NgZone],useFactory:C},H=650,G=s.normalizePassiveListenerOptions({passive:!0,capture:!0}),X=function(){function e(e,t){var n=this;this._ngZone=e,this._platform=t,this._origin=null,this._windowFocused=!1,this._elementInfo=new Map,this._monitoredElementCount=0,this._documentKeydownListener=function(){n._lastTouchTarget=null,n._setOriginForCurrentEventQueue("keyboard")},this._documentMousedownListener=function(){n._lastTouchTarget||n._setOriginForCurrentEventQueue("mouse")},this._documentTouchstartListener=function(e){null!=n._touchTimeoutId&&clearTimeout(n._touchTimeoutId),n._lastTouchTarget=e.target,n._touchTimeoutId=setTimeout(function(){return n._lastTouchTarget=null},H)},this._windowFocusListener=function(){n._windowFocused=!0,n._windowFocusTimeoutId=setTimeout(function(){return n._windowFocused=!1})}}return e.prototype.monitor=function(e,t){var n=this;if(void 0===t&&(t=!1),!this._platform.isBrowser)return r.of(null);var i=c.coerceElement(e);if(this._elementInfo.has(i)){var o=this._elementInfo.get(i);return o.checkChildren=t,o.subject.asObservable()}var s={unlisten:function(){},checkChildren:t,subject:new r.Subject};this._elementInfo.set(i,s),this._incrementMonitoredElementCount();var u=function(e){return n._onFocus(e,i)},a=function(e){return n._onBlur(e,i)};return this._ngZone.runOutsideAngular(function(){i.addEventListener("focus",u,!0),i.addEventListener("blur",a,!0)}),s.unlisten=function(){i.removeEventListener("focus",u,!0),i.removeEventListener("blur",a,!0)},s.subject.asObservable()},e.prototype.stopMonitoring=function(e){var t=c.coerceElement(e),n=this._elementInfo.get(t);n&&(n.unlisten(),n.subject.complete(),this._setClasses(t),this._elementInfo.delete(t),this._decrementMonitoredElementCount())},e.prototype.focusVia=function(e,t,n){var r=c.coerceElement(e);this._setOriginForCurrentEventQueue(t),"function"==typeof r.focus&&r.focus(n)},e.prototype.ngOnDestroy=function(){var e=this;this._elementInfo.forEach(function(t,n){return e.stopMonitoring(n)})},e.prototype._toggleClass=function(e,t,n){n?e.classList.add(t):e.classList.remove(t)},e.prototype._setClasses=function(e,t){this._elementInfo.get(e)&&(this._toggleClass(e,"cdk-focused",!!t),this._toggleClass(e,"cdk-touch-focused","touch"===t),this._toggleClass(e,"cdk-keyboard-focused","keyboard"===t),this._toggleClass(e,"cdk-mouse-focused","mouse"===t),this._toggleClass(e,"cdk-program-focused","program"===t))},e.prototype._setOriginForCurrentEventQueue=function(e){var t=this;this._ngZone.runOutsideAngular(function(){t._origin=e,t._originTimeoutId=setTimeout(function(){return t._origin=null},1)})},e.prototype._wasCausedByTouch=function(e){var t=e.target;return this._lastTouchTarget instanceof Node&&t instanceof Node&&(t===this._lastTouchTarget||t.contains(this._lastTouchTarget))},e.prototype._onFocus=function(e,t){var n=this._elementInfo.get(t);if(n&&(n.checkChildren||t===e.target)){var r=this._origin;r||(r=this._windowFocused&&this._lastFocusOrigin?this._lastFocusOrigin:this._wasCausedByTouch(e)?"touch":"program"),this._setClasses(t,r),this._emitOrigin(n.subject,r),this._lastFocusOrigin=r}},e.prototype._onBlur=function(e,t){var n=this._elementInfo.get(t);!n||n.checkChildren&&e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this._setClasses(t),this._emitOrigin(n.subject,null))},e.prototype._emitOrigin=function(e,t){this._ngZone.run(function(){return e.next(t)})},e.prototype._incrementMonitoredElementCount=function(){var e=this;1==++this._monitoredElementCount&&this._platform.isBrowser&&this._ngZone.runOutsideAngular(function(){document.addEventListener("keydown",e._documentKeydownListener,G),document.addEventListener("mousedown",e._documentMousedownListener,G),document.addEventListener("touchstart",e._documentTouchstartListener,G),window.addEventListener("focus",e._windowFocusListener)})},e.prototype._decrementMonitoredElementCount=function(){--this._monitoredElementCount||(document.removeEventListener("keydown",this._documentKeydownListener,G),document.removeEventListener("mousedown",this._documentMousedownListener,G),document.removeEventListener("touchstart",this._documentTouchstartListener,G),window.removeEventListener("focus",this._windowFocusListener),clearTimeout(this._windowFocusTimeoutId),clearTimeout(this._touchTimeoutId),clearTimeout(this._originTimeoutId))},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:n.NgZone},{type:s.Platform}]},e.ngInjectableDef=n.ɵɵdefineInjectable({factory:function(){return new e(n.ɵɵinject(n.NgZone),n.ɵɵinject(s.Platform))},token:e,providedIn:"root"}),e}(),J=function(){function e(e,t){var r=this;this._elementRef=e,this._focusMonitor=t,this.cdkFocusChange=new n.EventEmitter,this._monitorSubscription=this._focusMonitor.monitor(this._elementRef,this._elementRef.nativeElement.hasAttribute("cdkMonitorSubtreeFocus")).subscribe(function(e){return r.cdkFocusChange.emit(e)})}return e.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef),this._monitorSubscription.unsubscribe()},e.decorators=[{type:n.Directive,args:[{selector:"[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]"}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:X}]},e.propDecorators={cdkFocusChange:[{type:n.Output}]},e}(),$={provide:X,deps:[[new n.Optional,new n.SkipSelf,X],n.NgZone,s.Platform],useFactory:w},ee=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{imports:[t.CommonModule,s.PlatformModule,u.ObserversModule],declarations:[Y,V,J],exports:[Y,V,J]}]}],e}();e.ARIA_DESCRIBER_PROVIDER_FACTORY=p,e.MESSAGES_CONTAINER_ID="cdk-describedby-message-container",e.CDK_DESCRIBEDBY_ID_PREFIX="cdk-describedby-message",e.CDK_DESCRIBEDBY_HOST_ATTRIBUTE="cdk-describedby-host",e.AriaDescriber=D,e.ARIA_DESCRIBER_PROVIDER=j,e.ActiveDescendantKeyManager=P,e.FocusKeyManager=B,e.ListKeyManager=S,e.FocusTrap=Z,e.FocusTrapFactory=U,e.CdkTrapFocus=V,e.InteractivityChecker=K,e.LIVE_ANNOUNCER_PROVIDER_FACTORY=C,e.LiveAnnouncer=z,e.CdkAriaLive=Y,e.LIVE_ANNOUNCER_PROVIDER=Q,e.LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY=O,e.LIVE_ANNOUNCER_ELEMENT_TOKEN=W,e.LIVE_ANNOUNCER_DEFAULT_OPTIONS=q,e.FOCUS_MONITOR_PROVIDER_FACTORY=w,e.TOUCH_BUFFER_MS=H,e.FocusMonitor=X,e.CdkMonitorFocus=J,e.FOCUS_MONITOR_PROVIDER=$,e.isFakeMousedownFromScreenReader=N,e.A11yModule=ee,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=cdk-a11y.umd.min.js.map