{"version":3,"file":"upgrade-static.umd.min.js","sources":["../../../../packages/upgrade/static/src/static/upgrade_component.ts","../../../../packages/upgrade/static/src/static/angular1_providers.ts","../../../../packages/upgrade/static/src/common/angular1.ts","../../../../packages/upgrade/static/src/common/downgrade_component.ts","../../../../packages/upgrade/static/src/common/constants.ts","../../../../packages/upgrade/static/src/common/component_info.ts","../../../../packages/upgrade/static/src/common/util.ts","../../../../packages/upgrade/static/src/common/downgrade_component_adapter.ts","../../../../packages/upgrade/static/src/common/downgrade_injectable.ts","../../../../packages/upgrade/static/src/common/upgrade_helper.ts","../../../../packages/upgrade/static/src/static/upgrade_module.ts"],"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 */\n\nimport {DoCheck, ElementRef, EventEmitter, Injector, OnChanges, OnDestroy, OnInit, SimpleChanges, ɵlooseIdentical as looseIdentical} from '@angular/core';\nimport * as angular from '../common/angular1';\nimport {$SCOPE} from '../common/constants';\nimport {IBindingDestination, IControllerInstance, UpgradeHelper} from '../common/upgrade_helper';\nimport {isFunction} from '../common/util';\n\nconst NOT_SUPPORTED: any = 'NOT_SUPPORTED';\nconst INITIAL_VALUE = {\n __UNINITIALIZED__: true\n};\n\nclass Bindings {\n twoWayBoundProperties: string[] = [];\n twoWayBoundLastValues: any[] = [];\n\n expressionBoundProperties: string[] = [];\n\n propertyToOutputMap: {[propName: string]: string} = {};\n}\n\n/**\n * @whatItDoes\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AoT compilation*\n *\n * Allows an AngularJS component to be used from Angular.\n *\n * @howToUse\n *\n * Let's assume that you have an AngularJS component called `ng1Hero` that needs\n * to be made available in Angular templates.\n *\n * {@example upgrade/static/ts/module.ts region=\"ng1-hero\"}\n *\n * We must create a {@link Directive} that will make this AngularJS component\n * available inside Angular templates.\n *\n * {@example upgrade/static/ts/module.ts region=\"ng1-hero-wrapper\"}\n *\n * In this example you can see that we must derive from the {@link UpgradeComponent}\n * base class but also provide an {@link Directive `@Directive`} decorator. This is\n * because the AoT compiler requires that this information is statically available at\n * compile time.\n *\n * Note that we must do the following:\n * * specify the directive's selector (`ng1-hero`)\n * * specify all inputs and outputs that the AngularJS component expects\n * * derive from `UpgradeComponent`\n * * call the base class from the constructor, passing\n * * the AngularJS name of the component (`ng1Hero`)\n * * the {@link ElementRef} and {@link Injector} for the component wrapper\n *\n * @description\n *\n * A helper class that should be used as a base class for creating Angular directives\n * that wrap AngularJS components that need to be \"upgraded\".\n *\n * @experimental\n */\nexport class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy {\n private helper: UpgradeHelper;\n\n private $injector: angular.IInjectorService;\n\n private element: Element;\n private $element: angular.IAugmentedJQuery;\n private $componentScope: angular.IScope;\n\n private directive: angular.IDirective;\n private bindings: Bindings;\n\n private controllerInstance: IControllerInstance;\n private bindingDestination: IBindingDestination;\n\n // We will be instantiating the controller in the `ngOnInit` hook, when the first `ngOnChanges`\n // will have been already triggered. We store the `SimpleChanges` and \"play them back\" later.\n private pendingChanges: SimpleChanges|null;\n\n private unregisterDoCheckWatcher: Function;\n\n /**\n * Create a new `UpgradeComponent` instance. You should not normally need to do this.\n * Instead you should derive a new class from this one and call the super constructor\n * from the base class.\n *\n * {@example upgrade/static/ts/module.ts region=\"ng1-hero-wrapper\" }\n *\n * * The `name` parameter should be the name of the AngularJS directive.\n * * The `elementRef` and `injector` parameters should be acquired from Angular by dependency\n * injection into the base class constructor.\n *\n * Note that we must manually implement lifecycle hooks that call through to the super class.\n * This is because, at the moment, the AoT compiler is not able to tell that the\n * `UpgradeComponent`\n * already implements them and so does not wire up calls to them at runtime.\n */\n constructor(private name: string, private elementRef: ElementRef, private injector: Injector) {\n this.helper = new UpgradeHelper(injector, name, elementRef);\n\n this.$injector = this.helper.$injector;\n\n this.element = this.helper.element;\n this.$element = this.helper.$element;\n\n this.directive = this.helper.directive;\n this.bindings = this.initializeBindings(this.directive);\n\n // We ask for the AngularJS scope from the Angular injector, since\n // we will put the new component scope onto the new injector for each component\n const $parentScope = injector.get($SCOPE);\n // QUESTION 1: Should we create an isolated scope if the scope is only true?\n // QUESTION 2: Should we make the scope accessible through `$element.scope()/isolateScope()`?\n this.$componentScope = $parentScope.$new(!!this.directive.scope);\n\n this.initializeOutputs();\n }\n\n ngOnInit() {\n // Collect contents, insert and compile template\n const attachChildNodes: angular.ILinkFn|undefined = this.helper.prepareTransclusion();\n const linkFn = this.helper.compileTemplate();\n\n // Instantiate controller\n const controllerType = this.directive.controller;\n const bindToController = this.directive.bindToController;\n if (controllerType) {\n this.controllerInstance = this.helper.buildController(controllerType, this.$componentScope);\n } else if (bindToController) {\n throw new Error(\n `Upgraded directive '${this.directive.name}' specifies 'bindToController' but no controller.`);\n }\n\n // Set up outputs\n this.bindingDestination = bindToController ? this.controllerInstance : this.$componentScope;\n this.bindOutputs();\n\n // Require other controllers\n const requiredControllers =\n this.helper.resolveAndBindRequiredControllers(this.controllerInstance);\n\n // Hook: $onChanges\n if (this.pendingChanges) {\n this.forwardChanges(this.pendingChanges);\n this.pendingChanges = null;\n }\n\n // Hook: $onInit\n if (this.controllerInstance && isFunction(this.controllerInstance.$onInit)) {\n this.controllerInstance.$onInit();\n }\n\n // Hook: $doCheck\n if (this.controllerInstance && isFunction(this.controllerInstance.$doCheck)) {\n const callDoCheck = () => this.controllerInstance.$doCheck !();\n\n this.unregisterDoCheckWatcher = this.$componentScope.$parent.$watch(callDoCheck);\n callDoCheck();\n }\n\n // Linking\n const link = this.directive.link;\n const preLink = (typeof link == 'object') && (link as angular.IDirectivePrePost).pre;\n const postLink = (typeof link == 'object') ? (link as angular.IDirectivePrePost).post : link;\n const attrs: angular.IAttributes = NOT_SUPPORTED;\n const transcludeFn: angular.ITranscludeFunction = NOT_SUPPORTED;\n if (preLink) {\n preLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n }\n\n linkFn(this.$componentScope, null !, {parentBoundTranscludeFn: attachChildNodes});\n\n if (postLink) {\n postLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n }\n\n // Hook: $postLink\n if (this.controllerInstance && isFunction(this.controllerInstance.$postLink)) {\n this.controllerInstance.$postLink();\n }\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (!this.bindingDestination) {\n this.pendingChanges = changes;\n } else {\n this.forwardChanges(changes);\n }\n }\n\n ngDoCheck() {\n const twoWayBoundProperties = this.bindings.twoWayBoundProperties;\n const twoWayBoundLastValues = this.bindings.twoWayBoundLastValues;\n const propertyToOutputMap = this.bindings.propertyToOutputMap;\n\n twoWayBoundProperties.forEach((propName, idx) => {\n const newValue = this.bindingDestination[propName];\n const oldValue = twoWayBoundLastValues[idx];\n\n if (!looseIdentical(newValue, oldValue)) {\n const outputName = propertyToOutputMap[propName];\n const eventEmitter: EventEmitter = (this as any)[outputName];\n\n eventEmitter.emit(newValue);\n twoWayBoundLastValues[idx] = newValue;\n }\n });\n }\n\n ngOnDestroy() {\n if (isFunction(this.unregisterDoCheckWatcher)) {\n this.unregisterDoCheckWatcher();\n }\n if (this.controllerInstance && isFunction(this.controllerInstance.$onDestroy)) {\n this.controllerInstance.$onDestroy();\n }\n this.$componentScope.$destroy();\n }\n\n private initializeBindings(directive: angular.IDirective) {\n const btcIsObject = typeof directive.bindToController === 'object';\n if (btcIsObject && Object.keys(directive.scope).length) {\n throw new Error(\n `Binding definitions on scope and controller at the same time is not supported.`);\n }\n\n const context = (btcIsObject) ? directive.bindToController : directive.scope;\n const bindings = new Bindings();\n\n if (typeof context == 'object') {\n Object.keys(context).forEach(propName => {\n const definition = context[propName];\n const bindingType = definition.charAt(0);\n\n // QUESTION: What about `=*`? Ignore? Throw? Support?\n\n switch (bindingType) {\n case '@':\n case '<':\n // We don't need to do anything special. They will be defined as inputs on the\n // upgraded component facade and the change propagation will be handled by\n // `ngOnChanges()`.\n break;\n case '=':\n bindings.twoWayBoundProperties.push(propName);\n bindings.twoWayBoundLastValues.push(INITIAL_VALUE);\n bindings.propertyToOutputMap[propName] = propName + 'Change';\n break;\n case '&':\n bindings.expressionBoundProperties.push(propName);\n bindings.propertyToOutputMap[propName] = propName;\n break;\n default:\n let json = JSON.stringify(context);\n throw new Error(\n `Unexpected mapping '${bindingType}' in '${json}' in '${this.name}' directive.`);\n }\n });\n }\n\n return bindings;\n }\n\n private initializeOutputs() {\n // Initialize the outputs for `=` and `&` bindings\n this.bindings.twoWayBoundProperties.concat(this.bindings.expressionBoundProperties)\n .forEach(propName => {\n const outputName = this.bindings.propertyToOutputMap[propName];\n (this as any)[outputName] = new EventEmitter();\n });\n }\n\n private bindOutputs() {\n // Bind `&` bindings to the corresponding outputs\n this.bindings.expressionBoundProperties.forEach(propName => {\n const outputName = this.bindings.propertyToOutputMap[propName];\n const emitter = (this as any)[outputName];\n\n this.bindingDestination[propName] = (value: any) => emitter.emit(value);\n });\n }\n\n private forwardChanges(changes: SimpleChanges) {\n // Forward input changes to `bindingDestination`\n Object.keys(changes).forEach(\n propName => this.bindingDestination[propName] = changes[propName].currentValue);\n\n if (isFunction(this.bindingDestination.$onChanges)) {\n this.bindingDestination.$onChanges(changes);\n }\n }\n}\n","/**\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 */\n\nimport * as angular from '../common/angular1';\n\n// We have to do a little dance to get the ng1 injector into the module injector.\n// We store the ng1 injector so that the provider in the module injector can access it\n// Then we \"get\" the ng1 injector from the module injector, which triggers the provider to read\n// the stored injector and release the reference to it.\nlet tempInjectorRef: angular.IInjectorService|null;\nexport function setTempInjectorRef(injector: angular.IInjectorService) {\n tempInjectorRef = injector;\n}\nexport function injectorFactory() {\n if (!tempInjectorRef) {\n throw new Error('Trying to get the AngularJS injector before it being set.');\n }\n\n const injector: angular.IInjectorService|null = tempInjectorRef;\n tempInjectorRef = null; // clear the value to prevent memory leaks\n return injector;\n}\n\nexport function rootScopeFactory(i: angular.IInjectorService) {\n return i.get('$rootScope');\n}\n\nexport function compileFactory(i: angular.IInjectorService) {\n return i.get('$compile');\n}\n\nexport function parseFactory(i: angular.IInjectorService) {\n return i.get('$parse');\n}\n\nexport const angular1Providers = [\n // We must use exported named functions for the ng2 factories to keep the compiler happy:\n // > Metadata collected contains an error that will be reported at runtime:\n // > Function calls are not supported.\n // > Consider replacing the function or lambda with a reference to an exported function\n {provide: '$injector', useFactory: injectorFactory},\n {provide: '$rootScope', useFactory: rootScopeFactory, deps: ['$injector']},\n {provide: '$compile', useFactory: compileFactory, deps: ['$injector']},\n {provide: '$parse', useFactory: parseFactory, deps: ['$injector']}\n];\n","/**\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 */\n\nexport type Ng1Token = string;\n\nexport type Ng1Expression = string | Function;\n\nexport interface IAnnotatedFunction extends Function { $inject?: Ng1Token[]; }\n\nexport type IInjectable = (Ng1Token | Function)[] | IAnnotatedFunction;\n\nexport type SingleOrListOrMap = T | T[] | {[key: string]: T};\n\nexport interface IModule {\n name: string;\n requires: (string|IInjectable)[];\n config(fn: IInjectable): IModule;\n directive(selector: string, factory: IInjectable): IModule;\n component(selector: string, component: IComponent): IModule;\n controller(name: string, type: IInjectable): IModule;\n factory(key: Ng1Token, factoryFn: IInjectable): IModule;\n value(key: Ng1Token, value: any): IModule;\n constant(token: Ng1Token, value: any): IModule;\n run(a: IInjectable): IModule;\n}\nexport interface ICompileService {\n (element: Element|NodeList|Node[]|string, transclude?: Function): ILinkFn;\n}\nexport interface ILinkFn {\n (scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ILinkFnOptions): IAugmentedJQuery;\n $$slots?: {[slotName: string]: ILinkFn};\n}\nexport interface ILinkFnOptions {\n parentBoundTranscludeFn?: Function;\n transcludeControllers?: {[key: string]: any};\n futureParentElement?: Node;\n}\nexport interface IRootScopeService {\n $new(isolate?: boolean): IScope;\n $id: string;\n $parent: IScope;\n $root: IScope;\n $watch(exp: Ng1Expression, fn?: (a1?: any, a2?: any) => void): Function;\n $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function;\n $destroy(): any;\n $apply(exp?: Ng1Expression): any;\n $digest(): any;\n $evalAsync(exp: Ng1Expression, locals?: any): void;\n $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function;\n $$childTail: IScope;\n $$childHead: IScope;\n $$nextSibling: IScope;\n [key: string]: any;\n}\nexport interface IScope extends IRootScopeService {}\n\nexport interface IAngularBootstrapConfig { strictDi?: boolean; }\nexport interface IDirective {\n compile?: IDirectiveCompileFn;\n controller?: IController;\n controllerAs?: string;\n bindToController?: boolean|{[key: string]: string};\n link?: IDirectiveLinkFn|IDirectivePrePost;\n name?: string;\n priority?: number;\n replace?: boolean;\n require?: DirectiveRequireProperty;\n restrict?: string;\n scope?: boolean|{[key: string]: string};\n template?: string|Function;\n templateUrl?: string|Function;\n templateNamespace?: string;\n terminal?: boolean;\n transclude?: DirectiveTranscludeProperty;\n}\nexport type DirectiveRequireProperty = SingleOrListOrMap;\nexport type DirectiveTranscludeProperty = boolean | 'element' | {[key: string]: string};\nexport interface IDirectiveCompileFn {\n (templateElement: IAugmentedJQuery, templateAttributes: IAttributes,\n transclude: ITranscludeFunction): IDirectivePrePost;\n}\nexport interface IDirectivePrePost {\n pre?: IDirectiveLinkFn;\n post?: IDirectiveLinkFn;\n}\nexport interface IDirectiveLinkFn {\n (scope: IScope, instanceElement: IAugmentedJQuery, instanceAttributes: IAttributes,\n controller: any, transclude: ITranscludeFunction): void;\n}\nexport interface IComponent {\n bindings?: {[key: string]: string};\n controller?: string|IInjectable;\n controllerAs?: string;\n require?: DirectiveRequireProperty;\n template?: string|Function;\n templateUrl?: string|Function;\n transclude?: DirectiveTranscludeProperty;\n}\nexport interface IAttributes {\n $observe(attr: string, fn: (v: string) => void): void;\n [key: string]: any;\n}\nexport interface ITranscludeFunction {\n // If the scope is provided, then the cloneAttachFn must be as well.\n (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery;\n // If one argument is provided, then it's assumed to be the cloneAttachFn.\n (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;\n}\nexport interface ICloneAttachFunction {\n // Let's hint but not force cloneAttachFn's signature\n (clonedElement?: IAugmentedJQuery, scope?: IScope): any;\n}\nexport type IAugmentedJQuery = Node[] & {\n bind?: (name: string, fn: () => void) => void;\n data?: (name: string, value?: any) => any;\n text?: () => string;\n inheritedData?: (name: string, value?: any) => any;\n contents?: () => IAugmentedJQuery;\n parent?: () => IAugmentedJQuery;\n empty?: () => void;\n append?: (content: IAugmentedJQuery | string) => IAugmentedJQuery;\n controller?: (name: string) => any;\n isolateScope?: () => IScope;\n injector?: () => IInjectorService;\n};\nexport interface IProvider { $get: IInjectable; }\nexport interface IProvideService {\n provider(token: Ng1Token, provider: IProvider): IProvider;\n factory(token: Ng1Token, factory: IInjectable): IProvider;\n service(token: Ng1Token, type: IInjectable): IProvider;\n value(token: Ng1Token, value: any): IProvider;\n constant(token: Ng1Token, value: any): void;\n decorator(token: Ng1Token, factory: IInjectable): void;\n}\nexport interface IParseService { (expression: string): ICompiledExpression; }\nexport interface ICompiledExpression {\n (context: any, locals: any): any;\n assign?: (context: any, value: any) => any;\n}\nexport interface IHttpBackendService {\n (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number,\n withCredentials?: boolean): void;\n}\nexport interface ICacheObject {\n put(key: string, value?: T): T;\n get(key: string): any;\n}\nexport interface ITemplateCacheService extends ICacheObject {}\nexport interface ITemplateRequestService {\n (template: string|any /* TrustedResourceUrl */, ignoreRequestError?: boolean): Promise;\n totalPendingRequests: number;\n}\nexport type IController = string | IInjectable;\nexport interface IControllerService {\n (controllerConstructor: IController, locals?: any, later?: any, ident?: any): any;\n (controllerName: string, locals?: any): any;\n}\n\nexport interface IInjectorService {\n get(key: string): any;\n has(key: string): boolean;\n}\n\nexport interface IIntervalService {\n (func: Function, delay: number, count?: number, invokeApply?: boolean,\n ...args: any[]): Promise;\n cancel(promise: Promise): boolean;\n}\n\nexport interface ITestabilityService {\n findBindings(element: Element, expression: string, opt_exactMatch?: boolean): Element[];\n findModels(element: Element, expression: string, opt_exactMatch?: boolean): Element[];\n getLocation(): string;\n setLocation(url: string): void;\n whenStable(callback: Function): void;\n}\n\nexport interface INgModelController {\n $render(): void;\n $isEmpty(value: any): boolean;\n $setValidity(validationErrorKey: string, isValid: boolean): void;\n $setPristine(): void;\n $setDirty(): void;\n $setUntouched(): void;\n $setTouched(): void;\n $rollbackViewValue(): void;\n $validate(): void;\n $commitViewValue(): void;\n $setViewValue(value: any, trigger: string): void;\n\n $viewValue: any;\n $modelValue: any;\n $parsers: Function[];\n $formatters: Function[];\n $validators: {[key: string]: Function};\n $asyncValidators: {[key: string]: Function};\n $viewChangeListeners: Function[];\n $error: Object;\n $pending: Object;\n $untouched: boolean;\n $touched: boolean;\n $pristine: boolean;\n $dirty: boolean;\n $valid: boolean;\n $invalid: boolean;\n $name: string;\n}\n\nfunction noNg() {\n throw new Error('AngularJS v1.x is not loaded!');\n}\n\n\nlet angular: {\n bootstrap: (e: Element, modules: (string | IInjectable)[], config?: IAngularBootstrapConfig) =>\n IInjectorService,\n module: (prefix: string, dependencies?: string[]) => IModule,\n element: (e: Element | string) => IAugmentedJQuery,\n version: {major: number},\n resumeBootstrap: () => void,\n getTestability: (e: Element) => ITestabilityService\n} = {\n bootstrap: noNg,\n module: noNg,\n element: noNg,\n version: noNg,\n resumeBootstrap: noNg,\n getTestability: noNg\n};\n\ntry {\n if (window.hasOwnProperty('angular')) {\n angular = (window).angular;\n }\n} catch (e) {\n // ignore in CJS mode.\n}\n\n/**\n * Resets the AngularJS library.\n *\n * Used when angularjs is loaded lazily, and not available on `window`.\n *\n * @stable\n */\nexport function setAngularLib(ng: any): void {\n angular = ng;\n}\n\n/**\n * Returns the current version of the AngularJS library.\n *\n * @stable\n */\nexport function getAngularLib(): any {\n return angular;\n}\n\nexport const bootstrap =\n (e: Element, modules: (string | IInjectable)[], config?: IAngularBootstrapConfig) =>\n angular.bootstrap(e, modules, config);\n\nexport const module = (prefix: string, dependencies?: string[]) =>\n angular.module(prefix, dependencies);\n\nexport const element = (e: Element | string) => angular.element(e);\n\nexport const resumeBootstrap = () => angular.resumeBootstrap();\n\nexport const getTestability = (e: Element) => angular.getTestability(e);\n\nexport const version = angular.version;\n","/**\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 */\n\nimport {ComponentFactory, ComponentFactoryResolver, Injector, Type} from '@angular/core';\n\nimport * as angular from './angular1';\nimport {$COMPILE, $INJECTOR, $PARSE, INJECTOR_KEY, REQUIRE_INJECTOR, REQUIRE_NG_MODEL} from './constants';\nimport {DowngradeComponentAdapter} from './downgrade_component_adapter';\nimport {controllerKey, getComponentName} from './util';\n\n/**\n * @whatItDoes\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AoT compilation*\n *\n * Allows an Angular component to be used from AngularJS.\n *\n * @howToUse\n *\n * Let's assume that you have an Angular component called `ng2Heroes` that needs\n * to be made available in AngularJS templates.\n *\n * {@example upgrade/static/ts/module.ts region=\"ng2-heroes\"}\n *\n * We must create an AngularJS [directive](https://docs.angularjs.org/guide/directive)\n * that will make this Angular component available inside AngularJS templates.\n * The `downgradeComponent()` function returns a factory function that we\n * can use to define the AngularJS directive that wraps the \"downgraded\" component.\n *\n * {@example upgrade/static/ts/module.ts region=\"ng2-heroes-wrapper\"}\n *\n * @description\n *\n * A helper function that returns a factory function to be used for registering an\n * AngularJS wrapper directive for \"downgrading\" an Angular component.\n *\n * The parameter contains information about the Component that is being downgraded:\n *\n * * `component: Type`: The type of the Component that will be downgraded\n *\n * @experimental\n */\nexport function downgradeComponent(info: {\n component: Type;\n /** @deprecated since v4. This parameter is no longer used */\n inputs?: string[];\n /** @deprecated since v4. This parameter is no longer used */\n outputs?: string[];\n /** @deprecated since v4. This parameter is no longer used */\n selectors?: string[];\n}): any /* angular.IInjectable */ {\n const directiveFactory:\n angular.IAnnotatedFunction = function(\n $compile: angular.ICompileService,\n $injector: angular.IInjectorService,\n $parse: angular.IParseService): angular.IDirective {\n\n return {\n restrict: 'E',\n terminal: true,\n require: [REQUIRE_INJECTOR, REQUIRE_NG_MODEL],\n link: (scope: angular.IScope, element: angular.IAugmentedJQuery, attrs: angular.IAttributes,\n required: any[]) => {\n // We might have to compile the contents asynchronously, because this might have been\n // triggered by `UpgradeNg1ComponentAdapterBuilder`, before the Angular templates have\n // been compiled.\n\n const parentInjector: Injector|ParentInjectorPromise =\n required[0] || $injector.get(INJECTOR_KEY);\n const ngModel: angular.INgModelController = required[1];\n\n const downgradeFn = (injector: Injector) => {\n const componentFactoryResolver: ComponentFactoryResolver =\n injector.get(ComponentFactoryResolver);\n const componentFactory: ComponentFactory =\n componentFactoryResolver.resolveComponentFactory(info.component) !;\n\n if (!componentFactory) {\n throw new Error('Expecting ComponentFactory for: ' + getComponentName(info.component));\n }\n\n const injectorPromise = new ParentInjectorPromise(element);\n const facade = new DowngradeComponentAdapter(\n element, attrs, scope, ngModel, injector, $injector, $compile, $parse,\n componentFactory);\n\n const projectableNodes = facade.compileContents();\n facade.createComponent(projectableNodes);\n facade.setupInputs();\n facade.setupOutputs();\n facade.registerCleanup();\n\n injectorPromise.resolve(facade.getInjector());\n };\n\n if (parentInjector instanceof ParentInjectorPromise) {\n parentInjector.then(downgradeFn);\n } else {\n downgradeFn(parentInjector);\n }\n }\n };\n };\n\n // bracket-notation because of closure - see #14441\n directiveFactory['$inject'] = [$COMPILE, $INJECTOR, $PARSE];\n return directiveFactory;\n}\n\n/**\n * Synchronous promise-like object to wrap parent injectors,\n * to preserve the synchronous nature of Angular 1's $compile.\n */\nclass ParentInjectorPromise {\n private injector: Injector;\n private injectorKey: string = controllerKey(INJECTOR_KEY);\n private callbacks: ((injector: Injector) => any)[] = [];\n\n constructor(private element: angular.IAugmentedJQuery) {\n // Store the promise on the element.\n element.data !(this.injectorKey, this);\n }\n\n then(callback: (injector: Injector) => any) {\n if (this.injector) {\n callback(this.injector);\n } else {\n this.callbacks.push(callback);\n }\n }\n\n resolve(injector: Injector) {\n this.injector = injector;\n\n // Store the real injector on the element.\n this.element.data !(this.injectorKey, injector);\n\n // Release the element to prevent memory leaks.\n this.element = null !;\n\n // Run the queued callbacks.\n this.callbacks.forEach(callback => callback(injector));\n this.callbacks.length = 0;\n }\n}\n","/**\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 */\n\nexport const $COMPILE = '$compile';\nexport const $CONTROLLER = '$controller';\nexport const $DELEGATE = '$delegate';\nexport const $HTTP_BACKEND = '$httpBackend';\nexport const $INJECTOR = '$injector';\nexport const $INTERVAL = '$interval';\nexport const $PARSE = '$parse';\nexport const $PROVIDE = '$provide';\nexport const $ROOT_SCOPE = '$rootScope';\nexport const $SCOPE = '$scope';\nexport const $TEMPLATE_CACHE = '$templateCache';\nexport const $TEMPLATE_REQUEST = '$templateRequest';\n\nexport const $$TESTABILITY = '$$testability';\n\nexport const COMPILER_KEY = '$$angularCompiler';\nexport const GROUP_PROJECTABLE_NODES_KEY = '$$angularGroupProjectableNodes';\nexport const INJECTOR_KEY = '$$angularInjector';\nexport const NG_ZONE_KEY = '$$angularNgZone';\n\nexport const REQUIRE_INJECTOR = '?^^' + INJECTOR_KEY;\nexport const REQUIRE_NG_MODEL = '?ngModel';\n\nexport const UPGRADE_MODULE_NAME = '$$UpgradeModule';\n","/**\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 */\n\n/**\n * A `PropertyBinding` represents a mapping between a property name\n * and an attribute name. It is parsed from a string of the form\n * `\"prop: attr\"`; or simply `\"propAndAttr\" where the property\n * and attribute have the same identifier.\n */\nexport class PropertyBinding {\n bracketAttr: string;\n bracketParenAttr: string;\n parenAttr: string;\n onAttr: string;\n bindAttr: string;\n bindonAttr: string;\n\n constructor(public prop: string, public attr: string) { this.parseBinding(); }\n\n private parseBinding() {\n this.bracketAttr = `[${this.attr}]`;\n this.parenAttr = `(${this.attr})`;\n this.bracketParenAttr = `[(${this.attr})]`;\n const capitalAttr = this.attr.charAt(0).toUpperCase() + this.attr.substr(1);\n this.onAttr = `on${capitalAttr}`;\n this.bindAttr = `bind${capitalAttr}`;\n this.bindonAttr = `bindon${capitalAttr}`;\n }\n}\n","/**\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 */\n\nimport {Type} from '@angular/core';\nimport * as angular from './angular1';\n\nconst DIRECTIVE_PREFIX_REGEXP = /^(?:x|data)[:\\-_]/i;\nconst DIRECTIVE_SPECIAL_CHARS_REGEXP = /[:\\-_]+(.)/g;\n\nexport function onError(e: any) {\n // TODO: (misko): We seem to not have a stack trace here!\n if (console.error) {\n console.error(e, e.stack);\n } else {\n // tslint:disable-next-line:no-console\n console.log(e, e.stack);\n }\n throw e;\n}\n\nexport function controllerKey(name: string): string {\n return '$' + name + 'Controller';\n}\n\nexport function directiveNormalize(name: string): string {\n return name.replace(DIRECTIVE_PREFIX_REGEXP, '')\n .replace(DIRECTIVE_SPECIAL_CHARS_REGEXP, (_, letter) => letter.toUpperCase());\n}\n\nexport function getAttributesAsArray(node: Node): [string, string][] {\n const attributes = node.attributes;\n let asArray: [string, string][] = undefined !;\n if (attributes) {\n let attrLen = attributes.length;\n asArray = new Array(attrLen);\n for (let i = 0; i < attrLen; i++) {\n asArray[i] = [attributes[i].nodeName, attributes[i].nodeValue !];\n }\n }\n return asArray || [];\n}\n\nexport function getComponentName(component: Type): string {\n // Return the name of the component or the first line of its stringified version.\n return (component as any).overriddenName || component.name || component.toString().split('\\n')[0];\n}\n\nexport function isFunction(value: any): value is Function {\n return typeof value === 'function';\n}\n\nexport class Deferred {\n promise: Promise;\n resolve: (value?: R|PromiseLike) => void;\n reject: (error?: any) => void;\n\n constructor() {\n this.promise = new Promise((res, rej) => {\n this.resolve = res;\n this.reject = rej;\n });\n }\n}\n\n/**\n * @return Whether the passed-in component implements the subset of the\n * `ControlValueAccessor` interface needed for AngularJS `ng-model`\n * compatibility.\n */\nfunction supportsNgModel(component: any) {\n return typeof component.writeValue === 'function' &&\n typeof component.registerOnChange === 'function';\n}\n\n/**\n * Glue the AngularJS `NgModelController` (if it exists) to the component\n * (if it implements the needed subset of the `ControlValueAccessor` interface).\n */\nexport function hookupNgModel(ngModel: angular.INgModelController, component: any) {\n if (ngModel && supportsNgModel(component)) {\n ngModel.$render = () => { component.writeValue(ngModel.$viewValue); };\n component.registerOnChange(ngModel.$setViewValue.bind(ngModel));\n }\n}\n\n/**\n * Test two values for strict equality, accounting for the fact that `NaN !== NaN`.\n */\nexport function strictEquals(val1: any, val2: any): boolean {\n return val1 === val2 || (val1 !== val1 && val2 !== val2);\n}\n","/**\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 */\n\nimport {ChangeDetectorRef, ComponentFactory, ComponentRef, EventEmitter, Injector, OnChanges, ReflectiveInjector, SimpleChange, SimpleChanges, Type} from '@angular/core';\n\nimport * as angular from './angular1';\nimport {PropertyBinding} from './component_info';\nimport {$SCOPE} from './constants';\nimport {getAttributesAsArray, getComponentName, hookupNgModel, strictEquals} from './util';\n\nconst INITIAL_VALUE = {\n __UNINITIALIZED__: true\n};\n\nexport class DowngradeComponentAdapter {\n private inputChangeCount: number = 0;\n private inputChanges: SimpleChanges|null = null;\n private componentScope: angular.IScope;\n private componentRef: ComponentRef|null = null;\n private component: any = null;\n private changeDetector: ChangeDetectorRef|null = null;\n\n constructor(\n private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,\n private scope: angular.IScope, private ngModel: angular.INgModelController,\n private parentInjector: Injector, private $injector: angular.IInjectorService,\n private $compile: angular.ICompileService, private $parse: angular.IParseService,\n private componentFactory: ComponentFactory) {\n this.componentScope = scope.$new();\n }\n\n compileContents(): Node[][] {\n const compiledProjectableNodes: Node[][] = [];\n const projectableNodes: Node[][] = this.groupProjectableNodes();\n const linkFns = projectableNodes.map(nodes => this.$compile(nodes));\n\n this.element.empty !();\n\n linkFns.forEach(linkFn => {\n linkFn(this.scope, (clone: Node[]) => {\n compiledProjectableNodes.push(clone);\n this.element.append !(clone);\n });\n });\n\n return compiledProjectableNodes;\n }\n\n createComponent(projectableNodes: Node[][]) {\n const childInjector = ReflectiveInjector.resolveAndCreate(\n [{provide: $SCOPE, useValue: this.componentScope}], this.parentInjector);\n\n this.componentRef =\n this.componentFactory.create(childInjector, projectableNodes, this.element[0]);\n this.changeDetector = this.componentRef.changeDetectorRef;\n this.component = this.componentRef.instance;\n\n hookupNgModel(this.ngModel, this.component);\n }\n\n setupInputs(): void {\n const attrs = this.attrs;\n const inputs = this.componentFactory.inputs || [];\n for (let i = 0; i < inputs.length; i++) {\n const input = new PropertyBinding(inputs[i].propName, inputs[i].templateName);\n let expr: string|null = null;\n\n if (attrs.hasOwnProperty(input.attr)) {\n const observeFn = (prop => {\n let prevValue = INITIAL_VALUE;\n return (currValue: any) => {\n // Initially, both `$observe()` and `$watch()` will call this function.\n if (!strictEquals(prevValue, currValue)) {\n if (prevValue === INITIAL_VALUE) {\n prevValue = currValue;\n }\n\n this.updateInput(prop, prevValue, currValue);\n prevValue = currValue;\n }\n };\n })(input.prop);\n attrs.$observe(input.attr, observeFn);\n\n // Use `$watch()` (in addition to `$observe()`) in order to initialize the input in time\n // for `ngOnChanges()`. This is necessary if we are already in a `$digest`, which means that\n // `ngOnChanges()` (which is called by a watcher) will run before the `$observe()` callback.\n let unwatch: Function|null = this.componentScope.$watch(() => {\n unwatch !();\n unwatch = null;\n observeFn(attrs[input.attr]);\n });\n\n } else if (attrs.hasOwnProperty(input.bindAttr)) {\n expr = attrs[input.bindAttr];\n } else if (attrs.hasOwnProperty(input.bracketAttr)) {\n expr = attrs[input.bracketAttr];\n } else if (attrs.hasOwnProperty(input.bindonAttr)) {\n expr = attrs[input.bindonAttr];\n } else if (attrs.hasOwnProperty(input.bracketParenAttr)) {\n expr = attrs[input.bracketParenAttr];\n }\n if (expr != null) {\n const watchFn =\n (prop => (currValue: any, prevValue: any) =>\n this.updateInput(prop, prevValue, currValue))(input.prop);\n this.componentScope.$watch(expr, watchFn);\n }\n }\n\n const prototype = this.componentFactory.componentType.prototype;\n if (prototype && (prototype).ngOnChanges) {\n // Detect: OnChanges interface\n this.inputChanges = {};\n this.componentScope.$watch(() => this.inputChangeCount, () => {\n const inputChanges = this.inputChanges;\n this.inputChanges = {};\n (this.component).ngOnChanges(inputChanges !);\n });\n }\n this.componentScope.$watch(() => this.changeDetector && this.changeDetector.detectChanges());\n }\n\n setupOutputs() {\n const attrs = this.attrs;\n const outputs = this.componentFactory.outputs || [];\n for (let j = 0; j < outputs.length; j++) {\n const output = new PropertyBinding(outputs[j].propName, outputs[j].templateName);\n let expr: string|null = null;\n let assignExpr = false;\n\n const bindonAttr = output.bindonAttr.substring(0, output.bindonAttr.length - 6);\n const bracketParenAttr =\n `[(${output.bracketParenAttr.substring(2, output.bracketParenAttr.length - 8)})]`;\n\n if (attrs.hasOwnProperty(output.onAttr)) {\n expr = attrs[output.onAttr];\n } else if (attrs.hasOwnProperty(output.parenAttr)) {\n expr = attrs[output.parenAttr];\n } else if (attrs.hasOwnProperty(bindonAttr)) {\n expr = attrs[bindonAttr];\n assignExpr = true;\n } else if (attrs.hasOwnProperty(bracketParenAttr)) {\n expr = attrs[bracketParenAttr];\n assignExpr = true;\n }\n\n if (expr != null && assignExpr != null) {\n const getter = this.$parse(expr);\n const setter = getter.assign;\n if (assignExpr && !setter) {\n throw new Error(`Expression '${expr}' is not assignable!`);\n }\n const emitter = this.component[output.prop] as EventEmitter;\n if (emitter) {\n emitter.subscribe({\n next: assignExpr ? (v: any) => setter !(this.scope, v) :\n (v: any) => getter(this.scope, {'$event': v})\n });\n } else {\n throw new Error(\n `Missing emitter '${output.prop}' on component '${getComponentName(this.componentFactory.componentType)}'!`);\n }\n }\n }\n }\n\n registerCleanup() {\n this.element.bind !('$destroy', () => {\n this.componentScope.$destroy();\n this.componentRef !.destroy();\n });\n }\n\n getInjector(): Injector { return this.componentRef ! && this.componentRef !.injector; }\n\n private updateInput(prop: string, prevValue: any, currValue: any) {\n if (this.inputChanges) {\n this.inputChangeCount++;\n this.inputChanges[prop] = new SimpleChange(prevValue, currValue, prevValue === currValue);\n }\n\n this.component[prop] = currValue;\n }\n\n groupProjectableNodes() {\n let ngContentSelectors = this.componentFactory.ngContentSelectors;\n return groupNodesBySelector(ngContentSelectors, this.element.contents !());\n }\n}\n\n/**\n * Group a set of DOM nodes into `ngContent` groups, based on the given content selectors.\n */\nexport function groupNodesBySelector(ngContentSelectors: string[], nodes: Node[]): Node[][] {\n const projectableNodes: Node[][] = [];\n let wildcardNgContentIndex: number;\n\n for (let i = 0, ii = ngContentSelectors.length; i < ii; ++i) {\n projectableNodes[i] = [];\n }\n\n for (let j = 0, jj = nodes.length; j < jj; ++j) {\n const node = nodes[j];\n const ngContentIndex = findMatchingNgContentIndex(node, ngContentSelectors);\n if (ngContentIndex != null) {\n projectableNodes[ngContentIndex].push(node);\n }\n }\n\n return projectableNodes;\n}\n\nfunction findMatchingNgContentIndex(element: any, ngContentSelectors: string[]): number|null {\n const ngContentIndices: number[] = [];\n let wildcardNgContentIndex: number = -1;\n for (let i = 0; i < ngContentSelectors.length; i++) {\n const selector = ngContentSelectors[i];\n if (selector === '*') {\n wildcardNgContentIndex = i;\n } else {\n if (matchesSelector(element, selector)) {\n ngContentIndices.push(i);\n }\n }\n }\n ngContentIndices.sort();\n\n if (wildcardNgContentIndex !== -1) {\n ngContentIndices.push(wildcardNgContentIndex);\n }\n return ngContentIndices.length ? ngContentIndices[0] : null;\n}\n\nlet _matches: (this: any, selector: string) => boolean;\n\nfunction matchesSelector(el: any, selector: string): boolean {\n if (!_matches) {\n const elProto = Element.prototype;\n _matches = elProto.matches || elProto.matchesSelector || elProto.mozMatchesSelector ||\n elProto.msMatchesSelector || elProto.oMatchesSelector || elProto.webkitMatchesSelector;\n }\n return el.nodeType === Node.ELEMENT_NODE ? _matches.call(el, selector) : false;\n}\n","/**\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 */\n\nimport {Injector} from '@angular/core';\nimport {INJECTOR_KEY} from './constants';\n\n/**\n * @whatItDoes\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AoT compilation*\n *\n * Allow an Angular service to be accessible from AngularJS.\n *\n * @howToUse\n *\n * First ensure that the service to be downgraded is provided in an {@link NgModule}\n * that will be part of the upgrade application. For example, let's assume we have\n * defined `HeroesService`\n *\n * {@example upgrade/static/ts/module.ts region=\"ng2-heroes-service\"}\n *\n * and that we have included this in our upgrade app {@link NgModule}\n *\n * {@example upgrade/static/ts/module.ts region=\"ng2-module\"}\n *\n * Now we can register the `downgradeInjectable` factory function for the service\n * on an AngularJS module.\n *\n * {@example upgrade/static/ts/module.ts region=\"downgrade-ng2-heroes-service\"}\n *\n * Inside an AngularJS component's controller we can get hold of the\n * downgraded service via the name we gave when downgrading.\n *\n * {@example upgrade/static/ts/module.ts region=\"example-app\"}\n *\n * @description\n *\n * Takes a `token` that identifies a service provided from Angular.\n *\n * Returns a [factory function](https://docs.angularjs.org/guide/di) that can be\n * used to register the service on an AngularJS module.\n *\n * The factory function provides access to the Angular service that\n * is identified by the `token` parameter.\n *\n * @experimental\n */\nexport function downgradeInjectable(token: any): Function {\n const factory = function(i: Injector) { return i.get(token); };\n (factory as any)['$inject'] = [INJECTOR_KEY];\n\n return factory;\n}\n","/**\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 */\n\nimport {ElementRef, Injector, SimpleChanges} from '@angular/core';\n\nimport * as angular from './angular1';\nimport {$COMPILE, $CONTROLLER, $HTTP_BACKEND, $INJECTOR, $TEMPLATE_CACHE} from './constants';\nimport {controllerKey, directiveNormalize, isFunction} from './util';\n\n\n// Constants\nconst REQUIRE_PREFIX_RE = /^(\\^\\^?)?(\\?)?(\\^\\^?)?/;\n\n// Interfaces\nexport interface IBindingDestination {\n [key: string]: any;\n $onChanges?: (changes: SimpleChanges) => void;\n}\n\nexport interface IControllerInstance extends IBindingDestination {\n $doCheck?: () => void;\n $onDestroy?: () => void;\n $onInit?: () => void;\n $postLink?: () => void;\n}\n\n// Classes\nexport class UpgradeHelper {\n public readonly $injector: angular.IInjectorService;\n public readonly element: Element;\n public readonly $element: angular.IAugmentedJQuery;\n public readonly directive: angular.IDirective;\n\n private readonly $compile: angular.ICompileService;\n private readonly $controller: angular.IControllerService;\n\n constructor(\n private injector: Injector, private name: string, elementRef: ElementRef,\n directive?: angular.IDirective) {\n this.$injector = injector.get($INJECTOR);\n this.$compile = this.$injector.get($COMPILE);\n this.$controller = this.$injector.get($CONTROLLER);\n\n this.element = elementRef.nativeElement;\n this.$element = angular.element(this.element);\n\n this.directive = directive || UpgradeHelper.getDirective(this.$injector, name);\n }\n\n static getDirective($injector: angular.IInjectorService, name: string): angular.IDirective {\n const directives: angular.IDirective[] = $injector.get(name + 'Directive');\n if (directives.length > 1) {\n throw new Error(`Only support single directive definition for: ${name}`);\n }\n\n const directive = directives[0];\n\n // AngularJS will transform `link: xyz` to `compile: () => xyz`. So we can only tell there was a\n // user-defined `compile` if there is no `link`. In other cases, we will just ignore `compile`.\n if (directive.compile && !directive.link) notSupported(name, 'compile');\n if (directive.replace) notSupported(name, 'replace');\n if (directive.terminal) notSupported(name, 'terminal');\n\n return directive;\n }\n\n static getTemplate(\n $injector: angular.IInjectorService, directive: angular.IDirective,\n fetchRemoteTemplate = false): string|Promise {\n if (directive.template !== undefined) {\n return getOrCall(directive.template);\n } else if (directive.templateUrl) {\n const $templateCache = $injector.get($TEMPLATE_CACHE) as angular.ITemplateCacheService;\n const url = getOrCall(directive.templateUrl);\n const template = $templateCache.get(url);\n\n if (template !== undefined) {\n return template;\n } else if (!fetchRemoteTemplate) {\n throw new Error('loading directive templates asynchronously is not supported');\n }\n\n return new Promise((resolve, reject) => {\n const $httpBackend = $injector.get($HTTP_BACKEND) as angular.IHttpBackendService;\n $httpBackend('GET', url, null, (status: number, response: string) => {\n if (status === 200) {\n resolve($templateCache.put(url, response));\n } else {\n reject(`GET component template from '${url}' returned '${status}: ${response}'`);\n }\n });\n });\n } else {\n throw new Error(`Directive '${directive.name}' is not a component, it is missing template.`);\n }\n }\n\n buildController(controllerType: angular.IController, $scope: angular.IScope) {\n // TODO: Document that we do not pre-assign bindings on the controller instance.\n // Quoted properties below so that this code can be optimized with Closure Compiler.\n const locals = {'$scope': $scope, '$element': this.$element};\n const controller = this.$controller(controllerType, locals, null, this.directive.controllerAs);\n\n this.$element.data !(controllerKey(this.directive.name !), controller);\n\n return controller;\n }\n\n compileTemplate(template?: string): angular.ILinkFn {\n if (template === undefined) {\n template = UpgradeHelper.getTemplate(this.$injector, this.directive) as string;\n }\n\n return this.compileHtml(template);\n }\n\n prepareTransclusion(): angular.ILinkFn|undefined {\n const transclude = this.directive.transclude;\n const contentChildNodes = this.extractChildNodes();\n let $template = contentChildNodes;\n let attachChildrenFn: angular.ILinkFn|undefined = (scope, cloneAttach) =>\n cloneAttach !($template, scope);\n\n if (transclude) {\n const slots = Object.create(null);\n\n if (typeof transclude === 'object') {\n $template = [];\n\n const slotMap = Object.create(null);\n const filledSlots = Object.create(null);\n\n // Parse the element selectors.\n Object.keys(transclude).forEach(slotName => {\n let selector = transclude[slotName];\n const optional = selector.charAt(0) === '?';\n selector = optional ? selector.substring(1) : selector;\n\n slotMap[selector] = slotName;\n slots[slotName] = null; // `null`: Defined but not yet filled.\n filledSlots[slotName] = optional; // Consider optional slots as filled.\n });\n\n // Add the matching elements into their slot.\n contentChildNodes.forEach(node => {\n const slotName = slotMap[directiveNormalize(node.nodeName.toLowerCase())];\n if (slotName) {\n filledSlots[slotName] = true;\n slots[slotName] = slots[slotName] || [];\n slots[slotName].push(node);\n } else {\n $template.push(node);\n }\n });\n\n // Check for required slots that were not filled.\n Object.keys(filledSlots).forEach(slotName => {\n if (!filledSlots[slotName]) {\n throw new Error(`Required transclusion slot '${slotName}' on directive: ${this.name}`);\n }\n });\n\n Object.keys(slots).filter(slotName => slots[slotName]).forEach(slotName => {\n const nodes = slots[slotName];\n slots[slotName] = (scope: angular.IScope, cloneAttach: angular.ICloneAttachFunction) =>\n cloneAttach !(nodes, scope);\n });\n }\n\n // Attach `$$slots` to default slot transclude fn.\n attachChildrenFn.$$slots = slots;\n\n // AngularJS v1.6+ ignores empty or whitespace-only transcluded text nodes. But Angular\n // removes all text content after the first interpolation and updates it later, after\n // evaluating the expressions. This would result in AngularJS failing to recognize text\n // nodes that start with an interpolation as transcluded content and use the fallback\n // content instead.\n // To avoid this issue, we add a\n // [zero-width non-joiner character](https://en.wikipedia.org/wiki/Zero-width_non-joiner)\n // to empty text nodes (which can only be a result of Angular removing their initial content).\n // NOTE: Transcluded text content that starts with whitespace followed by an interpolation\n // will still fail to be detected by AngularJS v1.6+\n $template.forEach(node => {\n if (node.nodeType === Node.TEXT_NODE && !node.nodeValue) {\n node.nodeValue = '\\u200C';\n }\n });\n }\n\n return attachChildrenFn;\n }\n\n resolveAndBindRequiredControllers(controllerInstance: IControllerInstance|null) {\n const directiveRequire = this.getDirectiveRequire();\n const requiredControllers = this.resolveRequire(directiveRequire);\n\n if (controllerInstance && this.directive.bindToController && isMap(directiveRequire)) {\n const requiredControllersMap = requiredControllers as{[key: string]: IControllerInstance};\n Object.keys(requiredControllersMap).forEach(key => {\n controllerInstance[key] = requiredControllersMap[key];\n });\n }\n\n return requiredControllers;\n }\n\n private compileHtml(html: string): angular.ILinkFn {\n this.element.innerHTML = html;\n return this.$compile(this.element.childNodes);\n }\n\n private extractChildNodes(): Node[] {\n const childNodes: Node[] = [];\n let childNode: Node|null;\n\n while (childNode = this.element.firstChild) {\n this.element.removeChild(childNode);\n childNodes.push(childNode);\n }\n\n return childNodes;\n }\n\n private getDirectiveRequire(): angular.DirectiveRequireProperty {\n const require = this.directive.require || (this.directive.controller && this.directive.name) !;\n\n if (isMap(require)) {\n Object.keys(require).forEach(key => {\n const value = require[key];\n const match = value.match(REQUIRE_PREFIX_RE) !;\n const name = value.substring(match[0].length);\n\n if (!name) {\n require[key] = match[0] + key;\n }\n });\n }\n\n return require;\n }\n\n private resolveRequire(require: angular.DirectiveRequireProperty, controllerInstance?: any):\n angular.SingleOrListOrMap|null {\n if (!require) {\n return null;\n } else if (Array.isArray(require)) {\n return require.map(req => this.resolveRequire(req));\n } else if (typeof require === 'object') {\n const value: {[key: string]: IControllerInstance} = {};\n Object.keys(require).forEach(key => value[key] = this.resolveRequire(require[key]) !);\n return value;\n } else if (typeof require === 'string') {\n const match = require.match(REQUIRE_PREFIX_RE) !;\n const inheritType = match[1] || match[3];\n\n const name = require.substring(match[0].length);\n const isOptional = !!match[2];\n const searchParents = !!inheritType;\n const startOnParent = inheritType === '^^';\n\n const ctrlKey = controllerKey(name);\n const elem = startOnParent ? this.$element.parent !() : this.$element;\n const value = searchParents ? elem.inheritedData !(ctrlKey) : elem.data !(ctrlKey);\n\n if (!value && !isOptional) {\n throw new Error(\n `Unable to find required '${require}' in upgraded directive '${this.name}'.`);\n }\n\n return value;\n } else {\n throw new Error(\n `Unrecognized 'require' syntax on upgraded directive '${this.name}': ${require}`);\n }\n }\n}\n\nfunction getOrCall(property: T | Function): T {\n return isFunction(property) ? property() : property;\n}\n\n// NOTE: Only works for `typeof T !== 'object'`.\nfunction isMap(value: angular.SingleOrListOrMap): value is {[key: string]: T} {\n return value && !Array.isArray(value) && typeof value === 'object';\n}\n\nfunction notSupported(name: string, feature: string) {\n throw new Error(`Upgraded directive '${name}' contains unsupported feature: '${feature}'.`);\n}\n","/**\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 */\n\nimport {Injector, NgModule, NgZone, Testability, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR} from '@angular/core';\n\nimport * as angular from '../common/angular1';\nimport {$$TESTABILITY, $DELEGATE, $INJECTOR, $INTERVAL, $PROVIDE, INJECTOR_KEY, UPGRADE_MODULE_NAME} from '../common/constants';\nimport {controllerKey} from '../common/util';\n\nimport {angular1Providers, setTempInjectorRef} from './angular1_providers';\n\n\n/**\n * @whatItDoes\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AoT compilation*\n *\n * Allows AngularJS and Angular components to be used together inside a hybrid upgrade\n * application, which supports AoT compilation.\n *\n * Specifically, the classes and functions in the `upgrade/static` module allow the following:\n * 1. Creation of an Angular directive that wraps and exposes an AngularJS component so\n * that it can be used in an Angular template. See {@link UpgradeComponent}.\n * 2. Creation of an AngularJS directive that wraps and exposes an Angular component so\n * that it can be used in an AngularJS template. See {@link downgradeComponent}.\n * 3. Creation of an Angular root injector provider that wraps and exposes an AngularJS\n * service so that it can be injected into an Angular context. See\n * {@link UpgradeModule#upgrading-an-angular-1-service Upgrading an AngularJS service} below.\n * 4. Creation of an AngularJS service that wraps and exposes an Angular injectable\n * so that it can be injected into an AngularJS context. See {@link downgradeInjectable}.\n * 3. Bootstrapping of a hybrid Angular application which contains both of the frameworks\n * coexisting in a single application. See the\n * {@link UpgradeModule#example example} below.\n *\n * ## Mental Model\n *\n * When reasoning about how a hybrid application works it is useful to have a mental model which\n * describes what is happening and explains what is happening at the lowest level.\n *\n * 1. There are two independent frameworks running in a single application, each framework treats\n * the other as a black box.\n * 2. Each DOM element on the page is owned exactly by one framework. Whichever framework\n * instantiated the element is the owner. Each framework only updates/interacts with its own\n * DOM elements and ignores others.\n * 3. AngularJS directives always execute inside the AngularJS framework codebase regardless of\n * where they are instantiated.\n * 4. Angular components always execute inside the Angular framework codebase regardless of\n * where they are instantiated.\n * 5. An AngularJS component can be \"upgraded\"\" to an Angular component. This is achieved by\n * defining an Angular directive, which bootstraps the AngularJS component at its location\n * in the DOM. See {@link UpgradeComponent}.\n * 6. An Angular component can be \"downgraded\"\" to an AngularJS component. This is achieved by\n * defining an AngularJS directive, which bootstraps the Angular component at its location\n * in the DOM. See {@link downgradeComponent}.\n * 7. Whenever an \"upgraded\"/\"downgraded\" component is instantiated the host element is owned by\n * the framework doing the instantiation. The other framework then instantiates and owns the\n * view for that component.\n * a. This implies that the component bindings will always follow the semantics of the\n * instantiation framework.\n * b. The DOM attributes are parsed by the framework that owns the current template. So\n * attributes\n * in AngularJS templates must use kebab-case, while AngularJS templates must use camelCase.\n * c. However the template binding syntax will always use the Angular style, e.g. square\n * brackets (`[...]`) for property binding.\n * 8. AngularJS is always bootstrapped first and owns the root component.\n * 9. The new application is running in an Angular zone, and therefore it no longer needs calls\n * to\n * `$apply()`.\n *\n * @howToUse\n *\n * `import {UpgradeModule} from '@angular/upgrade/static';`\n *\n * ## Example\n * Import the {@link UpgradeModule} into your top level {@link NgModule Angular `NgModule`}.\n *\n * {@example upgrade/static/ts/module.ts region='ng2-module'}\n *\n * Then bootstrap the hybrid upgrade app's module, get hold of the {@link UpgradeModule} instance\n * and use it to bootstrap the top level [AngularJS\n * module](https://docs.angularjs.org/api/ng/type/angular.Module).\n *\n * {@example upgrade/static/ts/module.ts region='bootstrap'}\n *\n * {@a upgrading-an-angular-1-service}\n *\n * ## Upgrading an AngularJS service\n *\n * There is no specific API for upgrading an AngularJS service. Instead you should just follow the\n * following recipe:\n *\n * Let's say you have an AngularJS service:\n *\n * {@example upgrade/static/ts/module.ts region=\"ng1-title-case-service\"}\n *\n * Then you should define an Angular provider to be included in your {@link NgModule} `providers`\n * property.\n *\n * {@example upgrade/static/ts/module.ts region=\"upgrade-ng1-service\"}\n *\n * Then you can use the \"upgraded\" AngularJS service by injecting it into an Angular component\n * or service.\n *\n * {@example upgrade/static/ts/module.ts region=\"use-ng1-upgraded-service\"}\n *\n * @description\n *\n * This class is an `NgModule`, which you import to provide AngularJS core services,\n * and has an instance method used to bootstrap the hybrid upgrade application.\n *\n * ## Core AngularJS services\n * Importing this {@link NgModule} will add providers for the core\n * [AngularJS services](https://docs.angularjs.org/api/ng/service) to the root injector.\n *\n * ## Bootstrap\n * The runtime instance of this class contains a {@link UpgradeModule#bootstrap `bootstrap()`}\n * method, which you use to bootstrap the top level AngularJS module onto an element in the\n * DOM for the hybrid upgrade app.\n *\n * It also contains properties to access the {@link UpgradeModule#injector root injector}, the\n * bootstrap {@link NgZone} and the\n * [AngularJS $injector](https://docs.angularjs.org/api/auto/service/$injector).\n *\n * @experimental\n */\n\nexport class UpgradeModule {\n /**\n * The AngularJS `$injector` for the upgrade application.\n */\n public $injector: any /*angular.IInjectorService*/;\n /** The Angular Injector **/\n public injector: Injector;\n\n constructor(\n /** The root {@link Injector} for the upgrade application. */\n injector: Injector,\n /** The bootstrap zone for the upgrade application */\n public ngZone: NgZone) {\n this.injector = new NgAdapterInjector(injector);\n }\n\n /**\n * Bootstrap an AngularJS application from this NgModule\n * @param element the element on which to bootstrap the AngularJS application\n * @param [modules] the AngularJS modules to bootstrap for this application\n * @param [config] optional extra AngularJS bootstrap configuration\n */\n bootstrap(\n element: Element, modules: string[] = [], config?: any /*angular.IAngularBootstrapConfig*/) {\n const INIT_MODULE_NAME = UPGRADE_MODULE_NAME + '.init';\n\n // Create an ng1 module to bootstrap\n const initModule =\n angular\n .module(INIT_MODULE_NAME, [])\n\n .value(INJECTOR_KEY, this.injector)\n\n .config([\n $PROVIDE, $INJECTOR,\n ($provide: angular.IProvideService, $injector: angular.IInjectorService) => {\n if ($injector.has($$TESTABILITY)) {\n $provide.decorator($$TESTABILITY, [\n $DELEGATE,\n (testabilityDelegate: angular.ITestabilityService) => {\n const originalWhenStable: Function = testabilityDelegate.whenStable;\n const injector = this.injector;\n // Cannot use arrow function below because we need the context\n const newWhenStable = function(callback: Function) {\n originalWhenStable.call(testabilityDelegate, function() {\n const ng2Testability: Testability = injector.get(Testability);\n if (ng2Testability.isStable()) {\n callback();\n } else {\n ng2Testability.whenStable(\n newWhenStable.bind(testabilityDelegate, callback));\n }\n });\n };\n\n testabilityDelegate.whenStable = newWhenStable;\n return testabilityDelegate;\n }\n ]);\n }\n\n if ($injector.has($INTERVAL)) {\n $provide.decorator($INTERVAL, [\n $DELEGATE,\n (intervalDelegate: angular.IIntervalService) => {\n // Wrap the $interval service so that setInterval is called outside NgZone,\n // but the callback is still invoked within it. This is so that $interval\n // won't block stability, which preserves the behavior from AngularJS.\n let wrappedInterval =\n (fn: Function, delay: number, count?: number, invokeApply?: boolean,\n ...pass: any[]) => {\n return this.ngZone.runOutsideAngular(() => {\n return intervalDelegate((...args: any[]) => {\n // Run callback in the next VM turn - $interval calls\n // $rootScope.$apply, and running the callback in NgZone will\n // cause a '$digest already in progress' error if it's in the\n // same vm turn.\n setTimeout(() => { this.ngZone.run(() => fn(...args)); });\n }, delay, count, invokeApply, ...pass);\n });\n };\n\n (wrappedInterval as any)['cancel'] = intervalDelegate.cancel;\n return wrappedInterval;\n }\n ]);\n }\n }\n ])\n\n .run([\n $INJECTOR,\n ($injector: angular.IInjectorService) => {\n this.$injector = $injector;\n\n // Initialize the ng1 $injector provider\n setTempInjectorRef($injector);\n this.injector.get($INJECTOR);\n\n // Put the injector on the DOM, so that it can be \"required\"\n angular.element(element).data !(controllerKey(INJECTOR_KEY), this.injector);\n\n // Wire up the ng1 rootScope to run a digest cycle whenever the zone settles\n // We need to do this in the next tick so that we don't prevent the bootup\n // stabilizing\n setTimeout(() => {\n const $rootScope = $injector.get('$rootScope');\n const subscription =\n this.ngZone.onMicrotaskEmpty.subscribe(() => $rootScope.$digest());\n $rootScope.$on('$destroy', () => { subscription.unsubscribe(); });\n }, 0);\n }\n ]);\n\n const upgradeModule = angular.module(UPGRADE_MODULE_NAME, [INIT_MODULE_NAME].concat(modules));\n\n // Make sure resumeBootstrap() only exists if the current bootstrap is deferred\n const windowAngular = (window as any)['angular'];\n windowAngular.resumeBootstrap = undefined;\n\n // Bootstrap the AngularJS application inside our zone\n this.ngZone.run(() => { angular.bootstrap(element, [upgradeModule.name], config); });\n\n // Patch resumeBootstrap() to run inside the ngZone\n if (windowAngular.resumeBootstrap) {\n const originalResumeBootstrap: () => void = windowAngular.resumeBootstrap;\n const ngZone = this.ngZone;\n windowAngular.resumeBootstrap = function() {\n let args = arguments;\n windowAngular.resumeBootstrap = originalResumeBootstrap;\n ngZone.run(() => { windowAngular.resumeBootstrap.apply(this, args); });\n };\n }\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: NgModule, args: [{providers: [angular1Providers]}, ] },\n];\n/** @nocollapse */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: Injector, },\n{type: NgZone, },\n];\n}\n\nclass NgAdapterInjector implements Injector {\n constructor(private modInjector: Injector) {}\n\n // When Angular locate a service in the component injector tree, the not found value is set to\n // `NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR`. In such a case we should not walk up to the module\n // injector.\n // AngularJS only supports a single tree and should always check the module injector.\n get(token: any, notFoundValue?: any): any {\n if (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {\n return notFoundValue;\n }\n\n return this.modInjector.get(token, notFoundValue);\n }\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"],"names":["isFunction","property","setTempInjectorRef","injector","tempInjectorRef","injectorFactory","Error","i","get","angular","bootstrap","noNg","module","element","resumeBootstrap","_matches","$COMPILE","$CONTROLLER","$INJECTOR","PropertyBinding","prop","attr","this","parseBinding","prototype","parenAttr","DIRECTIVE_PREFIX_REGEXP","INITIAL_VALUE","__UNINITIALIZED__","DowngradeComponentAdapter","attrs","scope","ngModel","parentInjector","$injector","$compile","$parse","componentFactory","inputChangeCount","inputChanges","componentRef","component","changeDetector","componentScope","$new","compileContents","_this","compiledProjectableNodes","projectableNodes","groupProjectableNodes","linkFns","map","nodes","empty","forEach","linkFn","clone","push","append","createComponent","childInjector","_angular_core","ReflectiveInjector","resolveAndCreate","provide","$SCOPE","useValue","create","changeDetectorRef","instance","hookupNgModel","setupInputs","inputs","this_1","input","propName","templateName","hasOwnProperty","observeFn_1","prevValue","currValue","updateInput","$observe","unwatch_1","$watch","bindAttr","expr","bracketAttr","bindonAttr","bracketParenAttr","watchFn","componentType","ngOnChanges","detectChanges","setupOutputs","outputs","this_2","j","length","output","assignExpr","substring","onAttr","getter_1","setter_1","assign","emitter","getComponentName","next","v","$event","registerCleanup","bind","$destroy","destroy","getInjector","SimpleChange","ParentInjectorPromise","injectorKey","controllerKey","INJECTOR_KEY","callbacks","data","resolve","REQUIRE_PREFIX_RE","angular.element","UpgradeHelper","name","elementRef","directive","$controller","getDirective","directives","compile","link","notSupported","replace","terminal","getTemplate","fetchRemoteTemplate","undefined","template","getOrCall","templateUrl","$templateCache_1","url_1","Promise","reject","status","response","put","buildController","controllerType","$scope","locals","$element","controller","controllerAs","compileTemplate","compileHtml","prepareTransclusion","transclude","contentChildNodes","extractChildNodes","attachChildrenFn","cloneAttach","$template","slotMap_1","Object","keys","slotName","selector","optional","charAt","slots_1","filledSlots_1","node","nodeType","Node","TEXT_NODE","nodeValue","resolveAndBindRequiredControllers","controllerInstance","directiveRequire","getDirectiveRequire","requiredControllers","resolveRequire","bindToController","isMap","requiredControllersMap_1","key","html","innerHTML","childNodes","childNode","firstChild","removeChild","require","value","match","Array","isArray","req","value_1","inheritType","name_1","isOptional","searchParents","startOnParent","ctrlKey","elem","parent","inheritedData","INITIAL_VALUE$1","helper","$parentScope","initializeOutputs","attachChildNodes","bindingDestination","$componentScope","bindOutputs","pendingChanges","forwardChanges","$onInit","callDoCheck","$doCheck","unregisterDoCheckWatcher","$parent","preLink","pre","parentBoundTranscludeFn","postLink","$postLink","UpgradeComponent","changes","ngDoCheck","twoWayBoundProperties","bindings","twoWayBoundLastValues","propertyToOutputMap","idx","newValue","oldValue","ɵlooseIdentical","outputName","emit","ngOnDestroy","$onDestroy","initializeBindings","btcIsObject","context","definition","expressionBoundProperties","json","JSON","stringify","bindingType","concat","UpgradeModule","element$$1","modules","config","upgradeModule","module$1","UPGRADE_MODULE_NAME","$provide","has","testabilityDelegate","originalWhenStable","whenStable","newWhenStable","callback","call","ng2Testability","Testability","isStable","intervalDelegate","ngZone","runOutsideAngular","setTimeout","run","fn","apply","args","delay","count","invokeApply","pass","wrappedInterval","cancel","subscription","onMicrotaskEmpty","subscribe","$rootScope","$digest","windowAngular","window","originalResumeBootstrap_1","ngZone_1","arguments","decorators","type","NgModule","providers","angular1Providers","downgradeComponent","info","directiveFactory","REQUIRE_INJECTOR","REQUIRE_NG_MODEL","required","downgradeFn","componentFactoryResolver","ComponentFactoryResolver","resolveComponentFactory","injectorPromise","facade","then","groupNodesBySelector","ngContentSelectors","ii","jj","ngContentIndex","findMatchingNgContentIndex","ngContentIndices","wildcardNgContentIndex","matchesSelector","sort"],"mappings":";;;;;;;;;;;;;;;;;AEyOA,QAAAW,QAEI,KAAJ,IAAAL,OAAA,gGE3OA,MAAAG,SEiDA,QAAA8G,eAAAQ,MACA,MAAA,IAAAA,KAAA,+CAMA,MAAAA,MAAAS,QAAA9G,wBAAA,iZAsCA,QAAA4C,eAAAtC,QAAAS,qQCqHA,QAAAqR,sBAAAC,mBAAA3Q,OAIA,IAAA,GAHAJ,qBAGAzC,EAAA,EAAAyT,GAAAD,mBAAA7N,OAAA3F,EAAAyT,KAAAzT,EACAyC,iBAAAzC,KAGA,KAAA,GAAA0F,GAAA,EAAAgO,GAAA7Q,MAAA8C,OAAAD,EAAAgO,KAAAhO,EAAA,CACA,GAAA+E,MAAA5H,MAAA6C,GAC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