{"version":3,"file":"observers.es5.js","sources":["../../packages/cdk/esm5/observers/observe-content.js","../../packages/cdk/esm5/observers/index.js"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { Directive, ElementRef, NgModule, Output, Input, EventEmitter, Injectable, NgZone, } from '@angular/core';\nimport { Subject } from 'rxjs/Subject';\nimport { RxChain, debounceTime } from '@angular/cdk/rxjs';\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * \\@docs-private\n */\nvar MatMutationObserverFactory = (function () {\n function MatMutationObserverFactory() {\n }\n /**\n * @param {?} callback\n * @return {?}\n */\n MatMutationObserverFactory.prototype.create = function (callback) {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n };\n MatMutationObserverFactory.decorators = [\n { type: Injectable },\n ];\n /**\n * @nocollapse\n */\n MatMutationObserverFactory.ctorParameters = function () { return []; };\n return MatMutationObserverFactory;\n}());\nexport { MatMutationObserverFactory };\nfunction MatMutationObserverFactory_tsickle_Closure_declarations() {\n /** @type {?} */\n MatMutationObserverFactory.decorators;\n /**\n * @nocollapse\n * @type {?}\n */\n MatMutationObserverFactory.ctorParameters;\n}\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\nvar ObserveContent = (function () {\n /**\n * @param {?} _mutationObserverFactory\n * @param {?} _elementRef\n * @param {?} _ngZone\n */\n function ObserveContent(_mutationObserverFactory, _elementRef, _ngZone) {\n this._mutationObserverFactory = _mutationObserverFactory;\n this._elementRef = _elementRef;\n this._ngZone = _ngZone;\n /**\n * Event emitted for each change in the element's content.\n */\n this.event = new EventEmitter();\n /**\n * Used for debouncing the emitted values to the observeContent event.\n */\n this._debouncer = new Subject();\n }\n /**\n * @return {?}\n */\n ObserveContent.prototype.ngAfterContentInit = function () {\n var _this = this;\n if (this.debounce > 0) {\n this._ngZone.runOutsideAngular(function () {\n RxChain.from(_this._debouncer)\n .call(debounceTime, _this.debounce)\n .subscribe(function (mutations) { return _this.event.emit(mutations); });\n });\n }\n else {\n this._debouncer.subscribe(function (mutations) { return _this.event.emit(mutations); });\n }\n this._observer = this._ngZone.runOutsideAngular(function () {\n return _this._mutationObserverFactory.create(function (mutations) {\n _this._debouncer.next(mutations);\n });\n });\n if (this._observer) {\n this._observer.observe(this._elementRef.nativeElement, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n };\n /**\n * @return {?}\n */\n ObserveContent.prototype.ngOnDestroy = function () {\n if (this._observer) {\n this._observer.disconnect();\n }\n this._debouncer.complete();\n };\n ObserveContent.decorators = [\n { type: Directive, args: [{\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n },] },\n ];\n /**\n * @nocollapse\n */\n ObserveContent.ctorParameters = function () { return [\n { type: MatMutationObserverFactory, },\n { type: ElementRef, },\n { type: NgZone, },\n ]; };\n ObserveContent.propDecorators = {\n 'event': [{ type: Output, args: ['cdkObserveContent',] },],\n 'debounce': [{ type: Input },],\n };\n return ObserveContent;\n}());\nexport { ObserveContent };\nfunction ObserveContent_tsickle_Closure_declarations() {\n /** @type {?} */\n ObserveContent.decorators;\n /**\n * @nocollapse\n * @type {?}\n */\n ObserveContent.ctorParameters;\n /** @type {?} */\n ObserveContent.propDecorators;\n /** @type {?} */\n ObserveContent.prototype._observer;\n /**\n * Event emitted for each change in the element's content.\n * @type {?}\n */\n ObserveContent.prototype.event;\n /**\n * Used for debouncing the emitted values to the observeContent event.\n * @type {?}\n */\n ObserveContent.prototype._debouncer;\n /**\n * Debounce interval for emitting the changes.\n * @type {?}\n */\n ObserveContent.prototype.debounce;\n /** @type {?} */\n ObserveContent.prototype._mutationObserverFactory;\n /** @type {?} */\n ObserveContent.prototype._elementRef;\n /** @type {?} */\n ObserveContent.prototype._ngZone;\n}\nvar ObserversModule = (function () {\n function ObserversModule() {\n }\n ObserversModule.decorators = [\n { type: NgModule, args: [{\n exports: [ObserveContent],\n declarations: [ObserveContent],\n providers: [MatMutationObserverFactory]\n },] },\n ];\n /**\n * @nocollapse\n */\n ObserversModule.ctorParameters = function () { return []; };\n return ObserversModule;\n}());\nexport { ObserversModule };\nfunction ObserversModule_tsickle_Closure_declarations() {\n /** @type {?} */\n ObserversModule.decorators;\n /**\n * @nocollapse\n * @type {?}\n */\n ObserversModule.ctorParameters;\n}\n//# sourceMappingURL=observe-content.js.map","/**\n * Generated bundle index. Do not edit.\n */\nexport { MatMutationObserverFactory, ObserveContent, ObserversModule } from './public-api';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;;;;;AAUA;;;;AAIA,IAAI,0BAA0B,IAAI,YAAY;IAC1C,SAAS,0BAA0B,GAAG;KACrC;;;;;IAKD,0BAA0B,CAAC,SAAS,CAAC,MAAM,GAAG,UAAU,QAAQ,EAAE;QAC9D,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KAC1F,CAAC;IACF,0BAA0B,CAAC,UAAU,GAAG;QACpC,EAAE,IAAI,EAAE,UAAU,EAAE;KACvB,CAAC;;;;IAIF,0BAA0B,CAAC,cAAc,GAAG,YAAY,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACvE,OAAO,0BAA0B,CAAC;CACrC,EAAE,CAAC,CAAC;AACL,AACA,AASA;;;;AAIA,IAAI,cAAc,IAAI,YAAY;;;;;;IAM9B,SAAS,cAAc,CAAC,wBAAwB,EAAE,WAAW,EAAE,OAAO,EAAE;QACpE,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;;;QAIvB,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,EAAE,CAAC;;;;QAIhC,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,CAAC;KACnC;;;;IAID,cAA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