import { InjectionToken , Injector , INJECTOR , Type , ɵɵdirectiveInject , ɵglobal } from '@angular/core' ; declare const ngDevMode ; const NG_FACTORY_DEF = 'ɵfac' ; const InjectorInstance = Symbol ( 'InjectorInstance' ) ; const FactoryHasBeenDecorated = Symbol ( 'FactoryHasBeenDecorated' ) ; export function ensureLocalInjectorCaptured ( target ) { if ( FactoryHasBeenDecorated in target . constructor . prototype ) { return ; } const constructor = target . constructor ; if ( typeof constructor [ NG_FACTORY_DEF ] === 'function' ) { decorateFactory ( constructor ) ; } else if ( ngDevMode ) { decorateFactoryLater ( constructor ) ; } target . constructor . prototype [ FactoryHasBeenDecorated ] = true ; } export function localInject < T > ( instance , token ) { const injector = instance [ InjectorInstance ] ; return injector ? injector . get ( token ) : null ; } function decorateFactory ( constructor ) { const factory = constructor [ NG_FACTORY_DEF ] ; if ( typeof factory !== 'function' ) { return ; } const def = constructor . ɵprov || constructor . ɵpipe || constructor . ɵcmp || constructor . ɵdir ; const decoratedFactory = ( ) => { const instance = factory ( ) ; instance [ InjectorInstance ] = ɵɵdirectiveInject ( INJECTOR ) ; return instance ; } ; if ( def ) { def . factory = decoratedFactory ; } Object . defineProperty ( constructor , NG_FACTORY_DEF , { get : ( ) => decoratedFactory } ) ; } function decorateFactoryLater ( constructor ) { try { Promise . resolve ( ) . then ( ( ) => { decorateFactory ( constructor ) ; } ) ; } catch { ɵglobal . process && ɵglobal . process . nextTick && ɵglobal . process . nextTick ( ( ) => { decorateFactory ( constructor ) ; } ) ; } } type Factory = ( ) => PrivateInstance ; interface Definition { factory : Factory | null ; } interface ConstructorWithDefinitionAndFactory extends Function { ɵprov ? : Definition ; ɵpipe ? : Definition ; ɵcmp ? : Definition ; ɵdir ? : Definition ; [ NG_FACTORY_DEF ] ? : Factory ; } interface PrivateInstance { [ InjectorInstance ] ? : Injector ; }