@angular/core
Version:
Angular - the core framework
3,177 lines • 107 kB
JavaScript
/**
* @license Angular v22.1.3
* (c) 2010-2026 Google LLC. https://angular.dev/
* License: MIT
*/
import { getActiveConsumer, setActiveConsumer as setActiveConsumer$1, createSignal, SIGNAL, consumerDestroy, BASE_EFFECT_NODE, isInNotificationPhase, runEffect } from './_effect-chunk.mjs';
import { isNotFound, getCurrentInjector, setCurrentInjector } from './_not_found-chunk.mjs';
import { setActiveConsumer } from '@angular/core/primitives/signals';
import { isNotFound as isNotFound$1 } from '@angular/core/primitives/di';
import { BehaviorSubject, Observable, Subject, Subscription } from 'rxjs';
class Version {
full;
major;
minor;
patch;
constructor(full) {
this.full = full;
const parts = full.split('.');
this.major = parts[0];
this.minor = parts[1];
this.patch = parts.slice(2).join('.');
}
}
const VERSION = /* @__PURE__ */new Version('22.1.3');
const DOC_PAGE_BASE_URL = (() => {
const full = VERSION.full;
const isPreRelease = full.includes('-next') || full.includes('-rc') || full === '0.0.0' + '-PLACEHOLDER';
const prefix = isPreRelease ? 'next' : `v${VERSION.major}`;
return `https://${prefix}.angular.dev`;
})();
const ERROR_DETAILS_PAGE_BASE_URL = (() => {
return `${DOC_PAGE_BASE_URL}/errors`;
})();
const XSS_SECURITY_URL = 'https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss';
class RuntimeError extends Error {
code;
constructor(code, message) {
super(formatRuntimeError(code, message));
this.code = code;
}
}
function formatRuntimeErrorCode(code) {
return `NG0${Math.abs(code)}`;
}
function formatRuntimeError(code, message) {
const fullCode = formatRuntimeErrorCode(code);
let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
if (ngDevMode && code < 0) {
const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/);
const separator = addPeriodSeparator ? '.' : '';
errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
}
return errorMessage;
}
function getClosureSafeProperty(objWithPropertyToExtract) {
for (let key in objWithPropertyToExtract) {
if (objWithPropertyToExtract[key] === getClosureSafeProperty) {
return key;
}
}
throw Error(typeof ngDevMode !== 'undefined' && ngDevMode ? 'Could not find renamed property on target object.' : '');
}
function fillProperties(target, source) {
for (const key in source) {
if (Object.hasOwn(source, key) && !Object.hasOwn(target, key)) {
target[key] = source[key];
}
}
}
function stringify(token) {
if (typeof token === 'string') {
return token;
}
if (Array.isArray(token)) {
return `[${token.map(stringify).join(', ')}]`;
}
if (token == null) {
return '' + token;
}
const name = token.overriddenName || token.name;
if (name) {
return `${name}`;
}
const result = token.toString();
if (result == null) {
return '' + result;
}
const newLineIndex = result.indexOf('\n');
return newLineIndex >= 0 ? result.slice(0, newLineIndex) : result;
}
function concatStringsWithSpace(before, after) {
if (!before) return after || '';
if (!after) return before;
return `${before} ${after}`;
}
function truncateMiddle(str, maxLength = 100) {
if (!str || maxLength < 1 || str.length <= maxLength) return str;
if (maxLength == 1) return str.substring(0, 1) + '...';
const halfLimit = Math.round(maxLength / 2);
return str.substring(0, halfLimit) + '...' + str.substring(str.length - halfLimit);
}
const __forward_ref__ = getClosureSafeProperty({
__forward_ref__: getClosureSafeProperty
});
function forwardRef(forwardRefFn) {
forwardRefFn.__forward_ref__ = forwardRef;
if (ngDevMode) {
forwardRefFn.toString = function () {
return stringify(this());
};
}
return forwardRefFn;
}
function resolveForwardRef(type) {
return isForwardRef(type) ? type() : type;
}
function isForwardRef(fn) {
return typeof fn === 'function' && Object.hasOwn(fn, __forward_ref__) && fn.__forward_ref__ === forwardRef;
}
function assertNumber(actual, msg) {
if (!(typeof actual === 'number')) {
throwError(msg, typeof actual, 'number', '===');
}
}
function assertNumberInRange(actual, minInclusive, maxInclusive) {
assertNumber(actual, 'Expected a number');
assertLessThanOrEqual(actual, maxInclusive, 'Expected number to be less than or equal to');
assertGreaterThanOrEqual(actual, minInclusive, 'Expected number to be greater than or equal to');
}
function assertString(actual, msg) {
if (!(typeof actual === 'string')) {
throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
}
}
function assertFunction(actual, msg) {
if (!(typeof actual === 'function')) {
throwError(msg, actual === null ? 'null' : typeof actual, 'function', '===');
}
}
function assertEqual(actual, expected, msg) {
if (!(actual == expected)) {
throwError(msg, actual, expected, '==');
}
}
function assertNotEqual(actual, expected, msg) {
if (!(actual != expected)) {
throwError(msg, actual, expected, '!=');
}
}
function assertSame(actual, expected, msg) {
if (!(actual === expected)) {
throwError(msg, actual, expected, '===');
}
}
function assertNotSame(actual, expected, msg) {
if (!(actual !== expected)) {
throwError(msg, actual, expected, '!==');
}
}
function assertLessThan(actual, expected, msg) {
if (!(actual < expected)) {
throwError(msg, actual, expected, '<');
}
}
function assertLessThanOrEqual(actual, expected, msg) {
if (!(actual <= expected)) {
throwError(msg, actual, expected, '<=');
}
}
function assertGreaterThan(actual, expected, msg) {
if (!(actual > expected)) {
throwError(msg, actual, expected, '>');
}
}
function assertGreaterThanOrEqual(actual, expected, msg) {
if (!(actual >= expected)) {
throwError(msg, actual, expected, '>=');
}
}
function assertNotDefined(actual, msg) {
if (actual != null) {
throwError(msg, actual, null, '==');
}
}
function assertDefined(actual, msg) {
if (actual == null) {
throwError(msg, actual, null, '!=');
}
}
function throwError(msg, actual, expected, comparison) {
throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
}
function assertDomNode(node) {
if (!(node instanceof Node)) {
throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
}
}
function assertElement(node) {
if (!(node instanceof Element)) {
throwError(`The provided value must be an element but got ${stringify(node)}`);
}
}
function assertIndexInRange(arr, index) {
assertDefined(arr, 'Array must be defined.');
const maxLen = arr.length;
if (index < 0 || index >= maxLen) {
throwError(`Index expected to be less than ${maxLen} but got ${index}`);
}
}
function assertOneOf(value, ...validValues) {
if (validValues.indexOf(value) !== -1) return true;
throwError(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`);
}
function assertNotReactive(fn) {
if (getActiveConsumer() !== null) {
throwError(`${fn}() should never be called in a reactive context.`);
}
}
function ɵɵdefineInjectable(opts) {
return {
token: opts.token,
providedIn: opts.providedIn || null,
factory: opts.factory,
value: undefined
};
}
function ɵɵdefineInjector(options) {
return {
providers: options.providers || [],
imports: options.imports || []
};
}
function getInjectableDef(type) {
return getOwnDefinition(type, NG_PROV_DEF);
}
function isInjectable(type) {
return getInjectableDef(type) !== null;
}
function getOwnDefinition(type, field) {
return Object.hasOwn(type, field) && type[field] || null;
}
function getInheritedInjectableDef(type) {
const def = type?.[NG_PROV_DEF] ?? null;
if (def) {
ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself.\n` + `This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`);
return def;
} else {
return null;
}
}
function getInjectorDef(type) {
return type && Object.hasOwn(type, NG_INJ_DEF) ? type[NG_INJ_DEF] : null;
}
const NG_PROV_DEF = getClosureSafeProperty({
ɵprov: getClosureSafeProperty
});
const NG_INJ_DEF = getClosureSafeProperty({
ɵinj: getClosureSafeProperty
});
class InjectionToken {
_desc;
ngMetadataName = 'InjectionToken';
ɵprov;
constructor(_desc, options) {
this._desc = _desc;
this.ɵprov = undefined;
if (typeof options == 'number') {
(typeof ngDevMode === 'undefined' || ngDevMode) && assertLessThan(options, 0, 'Only negative numbers are supported here');
this.__NG_ELEMENT_ID__ = options;
} else if (options !== undefined) {
this.ɵprov = ɵɵdefineInjectable({
token: this,
providedIn: options.providedIn || 'root',
factory: options.factory
});
}
}
get multi() {
return this;
}
toString() {
return `InjectionToken ${this._desc}`;
}
}
let _injectorProfilerContext;
function getInjectorProfilerContext() {
!ngDevMode && throwError('getInjectorProfilerContext should never be called in production mode');
return _injectorProfilerContext;
}
function setInjectorProfilerContext(context) {
!ngDevMode && throwError('setInjectorProfilerContext should never be called in production mode');
const previous = _injectorProfilerContext;
_injectorProfilerContext = context;
return previous;
}
const injectorProfilerCallbacks = [];
const NOOP_PROFILER_REMOVAL = () => {};
function removeProfiler(profiler) {
const profilerIdx = injectorProfilerCallbacks.indexOf(profiler);
if (profilerIdx !== -1) {
injectorProfilerCallbacks.splice(profilerIdx, 1);
}
}
function setInjectorProfiler(injectorProfiler) {
!ngDevMode && throwError('setInjectorProfiler should never be called in production mode');
if (injectorProfiler !== null) {
if (!injectorProfilerCallbacks.includes(injectorProfiler)) {
injectorProfilerCallbacks.push(injectorProfiler);
}
return () => removeProfiler(injectorProfiler);
} else {
injectorProfilerCallbacks.length = 0;
return NOOP_PROFILER_REMOVAL;
}
}
function injectorProfiler(event) {
!ngDevMode && throwError('Injector profiler should never be called in production mode');
for (let i = 0; i < injectorProfilerCallbacks.length; i++) {
const injectorProfilerCallback = injectorProfilerCallbacks[i];
injectorProfilerCallback(event);
}
}
function emitProviderConfiguredEvent(eventProvider, isViewProvider = false) {
!ngDevMode && throwError('Injector profiler should never be called in production mode');
let token;
if (typeof eventProvider === 'function') {
token = eventProvider;
} else if (eventProvider instanceof InjectionToken) {
token = eventProvider;
} else {
token = resolveForwardRef(eventProvider.provide);
}
let provider = eventProvider;
if (eventProvider instanceof InjectionToken) {
provider = eventProvider.ɵprov || eventProvider;
}
injectorProfiler({
type: 2,
context: getInjectorProfilerContext(),
providerRecord: {
token,
provider,
isViewProvider
}
});
}
function emitInjectorToCreateInstanceEvent(token) {
!ngDevMode && throwError('Injector profiler should never be called in production mode');
injectorProfiler({
type: 5,
context: getInjectorProfilerContext(),
token: token
});
}
function emitInstanceCreatedByInjectorEvent(instance) {
!ngDevMode && throwError('Injector profiler should never be called in production mode');
injectorProfiler({
type: 1,
context: getInjectorProfilerContext(),
instance: {
value: instance
}
});
}
function emitInjectEvent(token, value, flags) {
!ngDevMode && throwError('Injector profiler should never be called in production mode');
injectorProfiler({
type: 0,
context: getInjectorProfilerContext(),
service: {
token,
value,
flags
}
});
}
function emitEffectCreatedEvent(effect) {
!ngDevMode && throwError('Injector profiler should never be called in production mode');
injectorProfiler({
type: 3,
context: getInjectorProfilerContext(),
effect
});
}
function emitAfterRenderEffectPhaseCreatedEvent(effectPhase) {
!ngDevMode && throwError('Injector profiler should never be called in production mode');
injectorProfiler({
type: 4,
context: getInjectorProfilerContext(),
effectPhase
});
}
function runInInjectorProfilerContext(injector, token, callback) {
!ngDevMode && throwError('runInInjectorProfilerContext should never be called in production mode');
const prevInjectContext = setInjectorProfilerContext({
injector,
token
});
try {
callback();
} finally {
setInjectorProfilerContext(prevInjectContext);
}
}
function isEnvironmentProviders(value) {
return value && !!value.ɵproviders;
}
const NG_COMP_DEF = getClosureSafeProperty({
ɵcmp: getClosureSafeProperty
});
const NG_DIR_DEF = getClosureSafeProperty({
ɵdir: getClosureSafeProperty
});
const NG_PIPE_DEF = getClosureSafeProperty({
ɵpipe: getClosureSafeProperty
});
const NG_MOD_DEF = getClosureSafeProperty({
ɵmod: getClosureSafeProperty
});
const NG_FACTORY_DEF = getClosureSafeProperty({
ɵfac: getClosureSafeProperty
});
const NG_ELEMENT_ID = getClosureSafeProperty({
__NG_ELEMENT_ID__: getClosureSafeProperty
});
const NG_ENV_ID = getClosureSafeProperty({
__NG_ENV_ID__: getClosureSafeProperty
});
function getNgModuleDef(type) {
assertTypeDefined(type, '@NgModule');
return type[NG_MOD_DEF] || null;
}
function getNgModuleDefOrThrow(type) {
const ngModuleDef = getNgModuleDef(type);
if (!ngModuleDef) {
throw new RuntimeError(915, (typeof ngDevMode === 'undefined' || ngDevMode) && `Type ${stringify(type)} does not have 'ɵmod' property.`);
}
return ngModuleDef;
}
function getComponentDef(type) {
assertTypeDefined(type, '@Component');
return type[NG_COMP_DEF] || null;
}
function getDirectiveDefOrThrow(type) {
const def = getDirectiveDef(type);
if (!def) {
throw new RuntimeError(916, (typeof ngDevMode === 'undefined' || ngDevMode) && `Type ${stringify(type)} does not have 'ɵdir' property.`);
}
return def;
}
function getDirectiveDef(type) {
assertTypeDefined(type, '@Directive');
return type[NG_DIR_DEF] || null;
}
function getPipeDef(type) {
assertTypeDefined(type, '@Pipe');
return type[NG_PIPE_DEF] || null;
}
function assertTypeDefined(type, symbolType) {
if (type == null) {
throw new RuntimeError(-919, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot read ${symbolType} metadata. This can indicate a runtime ` + `circular dependency in your app that needs to be resolved.`);
}
}
function isStandalone(type) {
const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type);
return def !== null && def.standalone;
}
function renderStringify(value) {
if (typeof value === 'string') return value;
if (value == null) return '';
return String(value);
}
function stringifyForError(value) {
if (typeof value === 'function') return value.name || value.toString();
if (typeof value === 'object' && value != null && typeof value.type === 'function') {
return value.type.name || value.type.toString();
}
return renderStringify(value);
}
function debugStringifyTypeForError(type) {
const componentDef = getComponentDef(type);
if (componentDef !== null && componentDef.debugInfo) {
return stringifyTypeFromDebugInfo(componentDef.debugInfo);
}
return stringifyForError(type);
}
function stringifyTypeFromDebugInfo(debugInfo) {
if (!debugInfo.filePath || !debugInfo.lineNumber) {
return debugInfo.className;
} else {
return `${debugInfo.className} (at ${debugInfo.filePath}:${debugInfo.lineNumber})`;
}
}
const NG_RUNTIME_ERROR_CODE = getClosureSafeProperty({
'ngErrorCode': getClosureSafeProperty
});
const NG_RUNTIME_ERROR_MESSAGE = getClosureSafeProperty({
'ngErrorMessage': getClosureSafeProperty
});
const NG_TOKEN_PATH = getClosureSafeProperty({
'ngTokenPath': getClosureSafeProperty
});
function cyclicDependencyError(token, path) {
const message = ngDevMode ? `Circular dependency detected for \`${token}\`.` : '';
return createRuntimeError(message, -200, path);
}
function cyclicDependencyErrorWithDetails(token, path) {
return augmentRuntimeError(cyclicDependencyError(token, path), null);
}
function throwMixedMultiProviderError() {
throw new Error(`Cannot mix multi providers and regular providers`);
}
function throwInvalidProviderError(ngModuleType, providers, provider) {
if (ngModuleType && providers) {
const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');
throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`);
} else if (isEnvironmentProviders(provider)) {
if (provider.ɵfromNgModule) {
throw new RuntimeError(-207, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`);
} else {
throw new RuntimeError(-207, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`);
}
} else {
throw new Error('Invalid provider');
}
}
function throwProviderNotFoundError(token, injectorName) {
const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ''}`;
throw new RuntimeError(-201, errorMessage);
}
function prependTokenToDependencyPath(error, token) {
error[NG_TOKEN_PATH] ??= [];
const currentPath = error[NG_TOKEN_PATH];
let pathStr;
if (typeof token === 'object' && 'multi' in token && token?.multi === true) {
assertDefined(token.provide, 'Token with multi: true should have a provide property');
pathStr = stringifyForError(token.provide);
} else {
pathStr = stringifyForError(token);
}
if (currentPath[0] !== pathStr) {
error[NG_TOKEN_PATH].unshift(pathStr);
}
}
function augmentRuntimeError(error, source) {
const tokenPath = error[NG_TOKEN_PATH];
const errorCode = error[NG_RUNTIME_ERROR_CODE];
const message = error[NG_RUNTIME_ERROR_MESSAGE] || error.message;
error.message = formatErrorMessage(message, errorCode, tokenPath, source);
return error;
}
function createRuntimeError(message, code, path) {
const error = new RuntimeError(code, message);
error[NG_RUNTIME_ERROR_CODE] = code;
error[NG_RUNTIME_ERROR_MESSAGE] = message;
if (path) {
error[NG_TOKEN_PATH] = path;
}
return error;
}
function getRuntimeErrorCode(error) {
return error[NG_RUNTIME_ERROR_CODE];
}
function formatErrorMessage(text, code, path = [], source = null) {
let pathDetails = '';
if (path && path.length > 1) {
pathDetails = ` Path: ${path.join(' -> ')}.`;
}
const sourceDetails = source ? ` Source: ${source}.` : '';
return formatRuntimeError(code, `${text}${sourceDetails}${pathDetails}`);
}
let _injectImplementation;
function getInjectImplementation() {
return _injectImplementation;
}
function setInjectImplementation(impl) {
const previous = _injectImplementation;
_injectImplementation = impl;
return previous;
}
function injectRootLimpMode(token, notFoundValue, flags) {
const injectableDef = getInjectableDef(token);
if (injectableDef && injectableDef.providedIn == 'root') {
return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() : injectableDef.value;
}
if (flags & 8) return null;
if (notFoundValue !== undefined) return notFoundValue;
throwProviderNotFoundError(token, typeof ngDevMode !== 'undefined' && ngDevMode ? 'Injector' : '');
}
function assertInjectImplementationNotEqual(fn) {
ngDevMode && assertNotEqual(_injectImplementation, fn, 'Calling ɵɵinject would cause infinite recursion');
}
const _global = globalThis;
function ngDevModeResetPerfCounters() {
const locationString = typeof location !== 'undefined' ? location.toString() : '';
const newCounters = {
hydratedNodes: 0,
hydratedComponents: 0,
dehydratedViewsRemoved: 0,
dehydratedViewsCleanupRuns: 0,
componentsSkippedHydration: 0,
deferBlocksWithIncrementalHydration: 0
};
const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;
if (!allowNgDevModeTrue) {
_global['ngDevMode'] = false;
} else {
if (typeof _global['ngDevMode'] !== 'object') {
_global['ngDevMode'] = {};
}
Object.assign(_global['ngDevMode'], newCounters);
}
return newCounters;
}
function initNgDevMode() {
if (typeof ngDevMode === 'undefined' || ngDevMode) {
if (typeof ngDevMode !== 'object' || Object.keys(ngDevMode).length === 0) {
ngDevModeResetPerfCounters();
}
return typeof ngDevMode !== 'undefined' && !!ngDevMode;
}
return false;
}
const _THROW_IF_NOT_FOUND = {};
const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
const DI_DECORATOR_FLAG = '__NG_DI_FLAG__';
class RetrievingInjector {
injector;
constructor(injector) {
this.injector = injector;
}
retrieve(token, options) {
const flags = convertToBitFlags(options) || 0;
try {
return this.injector.get(token, flags & 8 ? null : THROW_IF_NOT_FOUND, flags);
} catch (e) {
if (isNotFound(e)) {
return e;
}
throw e;
}
}
}
function injectInjectorOnly(token, flags = 0) {
const currentInjector = getCurrentInjector();
if (currentInjector === undefined) {
throw new RuntimeError(-203, ngDevMode && `The \`${stringify(token)}\` token injection failed. \`inject()\` function must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`runInInjectionContext\`.`);
} else if (currentInjector === null) {
return injectRootLimpMode(token, undefined, flags);
} else {
const options = convertToInjectOptions(flags);
const value = currentInjector.retrieve(token, options);
ngDevMode && emitInjectEvent(token, value, flags);
if (isNotFound(value)) {
if (options.optional) {
return null;
}
throw value;
}
return value;
}
}
function ɵɵinject(token, flags = 0) {
return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
}
function ɵɵinvalidFactoryDep(index) {
throw new RuntimeError(202, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
}
function inject(token, options) {
return ɵɵinject(token, convertToBitFlags(options));
}
function convertToBitFlags(flags) {
if (typeof flags === 'undefined' || typeof flags === 'number') {
return flags;
}
return 0 | (flags.optional && 8) | (flags.host && 1) | (flags.self && 2) | (flags.skipSelf && 4);
}
function convertToInjectOptions(flags) {
return {
optional: !!(flags & 8),
host: !!(flags & 1),
self: !!(flags & 2),
skipSelf: !!(flags & 4)
};
}
function injectArgs(types) {
const args = [];
for (let i = 0; i < types.length; i++) {
const arg = resolveForwardRef(types[i]);
if (Array.isArray(arg)) {
if (arg.length === 0) {
throw new RuntimeError(900, ngDevMode && 'Arguments array must have arguments.');
}
let type = undefined;
let flags = 0;
for (let j = 0; j < arg.length; j++) {
const meta = arg[j];
const flag = getInjectFlag(meta);
if (typeof flag === 'number') {
if (flag === -1) {
type = meta.token;
} else {
flags |= flag;
}
} else {
type = meta;
}
}
args.push(ɵɵinject(type, flags));
} else {
args.push(ɵɵinject(arg));
}
}
return args;
}
function attachInjectFlag(decorator, flag) {
decorator[DI_DECORATOR_FLAG] = flag;
decorator.prototype[DI_DECORATOR_FLAG] = flag;
return decorator;
}
function getInjectFlag(token) {
return token[DI_DECORATOR_FLAG];
}
function getFactoryDef(type, throwNotFound) {
const hasFactoryDef = Object.hasOwn(type, NG_FACTORY_DEF);
if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);
}
return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
}
function arrayEquals(a, b, identityAccessor) {
if (a.length !== b.length) return false;
for (let i = 0; i < a.length; i++) {
let valueA = a[i];
let valueB = b[i];
if (identityAccessor) {
valueA = identityAccessor(valueA);
valueB = identityAccessor(valueB);
}
if (valueB !== valueA) {
return false;
}
}
return true;
}
function flatten(list) {
return list.flat(Number.POSITIVE_INFINITY);
}
function deepForEach(input, fn) {
input.forEach(value => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
}
function addToArray(arr, index, value) {
if (index >= arr.length) {
arr.push(value);
} else {
arr.splice(index, 0, value);
}
}
function removeFromArray(arr, index) {
if (index >= arr.length - 1) {
return arr.pop();
} else {
return arr.splice(index, 1)[0];
}
}
function newArray(size, value) {
const list = [];
for (let i = 0; i < size; i++) {
list.push(value);
}
return list;
}
function arraySplice(array, index, count) {
const length = array.length - count;
while (index < length) {
array[index] = array[index + count];
index++;
}
while (count--) {
array.pop();
}
}
function arrayInsert2(array, index, value1, value2) {
ngDevMode && assertLessThanOrEqual(index, array.length, "Can't insert past array end.");
let end = array.length;
if (end == index) {
array.push(value1, value2);
} else if (end === 1) {
array.push(value2, array[0]);
array[0] = value1;
} else {
end--;
array.push(array[end - 1], array[end]);
while (end > index) {
const previousEnd = end - 2;
array[end] = array[previousEnd];
end--;
}
array[index] = value1;
array[index + 1] = value2;
}
}
function keyValueArraySet(keyValueArray, key, value) {
let index = keyValueArrayIndexOf(keyValueArray, key);
if (index >= 0) {
keyValueArray[index | 1] = value;
} else {
index = ~index;
arrayInsert2(keyValueArray, index, key, value);
}
return index;
}
function keyValueArrayGet(keyValueArray, key) {
const index = keyValueArrayIndexOf(keyValueArray, key);
if (index >= 0) {
return keyValueArray[index | 1];
}
return undefined;
}
function keyValueArrayIndexOf(keyValueArray, key) {
return _arrayIndexOfSorted(keyValueArray, key, 1);
}
function _arrayIndexOfSorted(array, value, shift) {
ngDevMode && assertEqual(Array.isArray(array), true, 'Expecting an array');
let start = 0;
let end = array.length >> shift;
while (end !== start) {
const middle = start + (end - start >> 1);
const current = array[middle << shift];
if (value === current) {
return middle << shift;
} else if (current > value) {
end = middle;
} else {
start = middle + 1;
}
}
return ~(end << shift);
}
const EMPTY_OBJ = {};
const EMPTY_ARRAY = [];
if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
Object.freeze(EMPTY_OBJ);
Object.freeze(EMPTY_ARRAY);
}
const ENVIRONMENT_INITIALIZER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'ENVIRONMENT_INITIALIZER' : '');
const INJECTOR$1 = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'INJECTOR' : '', -1);
const INJECTOR_DEF_TYPES = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'INJECTOR_DEF_TYPES' : '');
class NullInjector {
get(token, notFoundValue = THROW_IF_NOT_FOUND) {
if (notFoundValue === THROW_IF_NOT_FOUND) {
const message = ngDevMode ? `No provider found for \`${stringify(token)}\`.` : '';
const error = createRuntimeError(message, -201);
error.name = 'ɵNotFound';
throw error;
}
return notFoundValue;
}
}
function makeEnvironmentProviders(providers) {
return {
ɵproviders: providers
};
}
function provideEnvironmentInitializer(initializerFn) {
return makeEnvironmentProviders([{
provide: ENVIRONMENT_INITIALIZER,
multi: true,
useValue: initializerFn
}]);
}
function importProvidersFrom(...sources) {
return {
ɵproviders: internalImportProvidersFrom(true, sources),
ɵfromNgModule: true
};
}
function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {
const providersOut = [];
const dedup = new Set();
let injectorTypesWithProviders;
const collectProviders = provider => {
providersOut.push(provider);
};
deepForEach(sources, source => {
if ((typeof ngDevMode === 'undefined' || ngDevMode) && checkForStandaloneCmp) {
const cmpDef = getComponentDef(source);
if (cmpDef?.standalone) {
throw new RuntimeError(800, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component "${stringifyForError(source)}"`);
}
}
const internalSource = source;
if (walkProviderTree(internalSource, collectProviders, [], dedup)) {
injectorTypesWithProviders ||= [];
injectorTypesWithProviders.push(internalSource);
}
});
if (injectorTypesWithProviders !== undefined) {
processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders);
}
return providersOut;
}
function processInjectorTypesWithProviders(typesWithProviders, visitor) {
for (let i = 0; i < typesWithProviders.length; i++) {
const {
ngModule,
providers
} = typesWithProviders[i];
deepForEachProvider(providers, provider => {
ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule);
visitor(provider, ngModule);
});
}
}
function walkProviderTree(container, visitor, parents, dedup) {
container = resolveForwardRef(container);
if (!container) return false;
let defType = null;
let injDef = getInjectorDef(container);
const cmpDef = !injDef && getComponentDef(container);
if (!injDef && !cmpDef) {
const ngModule = container.ngModule;
injDef = getInjectorDef(ngModule);
if (injDef) {
defType = ngModule;
} else {
return false;
}
} else if (cmpDef && !cmpDef.standalone) {
return false;
} else {
defType = container;
}
if (ngDevMode && parents.indexOf(defType) !== -1) {
const defName = stringify(defType);
const path = parents.map(stringify).concat(defName);
throw cyclicDependencyErrorWithDetails(defName, path);
}
const isDuplicate = dedup.has(defType);
if (cmpDef) {
if (isDuplicate) {
return false;
}
dedup.add(defType);
if (cmpDef.dependencies) {
const deps = typeof cmpDef.dependencies === 'function' ? cmpDef.dependencies() : cmpDef.dependencies;
for (const dep of deps) {
walkProviderTree(dep, visitor, parents, dedup);
}
}
} else if (injDef) {
if (injDef.imports != null && !isDuplicate) {
ngDevMode && parents.push(defType);
dedup.add(defType);
let importTypesWithProviders;
try {
deepForEach(injDef.imports, imported => {
if (walkProviderTree(imported, visitor, parents, dedup)) {
importTypesWithProviders ||= [];
importTypesWithProviders.push(imported);
}
});
} finally {
ngDevMode && parents.pop();
}
if (importTypesWithProviders !== undefined) {
processInjectorTypesWithProviders(importTypesWithProviders, visitor);
}
}
if (!isDuplicate) {
const factory = getFactoryDef(defType) || (() => new defType());
visitor({
provide: defType,
useFactory: factory,
deps: EMPTY_ARRAY
}, defType);
visitor({
provide: INJECTOR_DEF_TYPES,
useValue: defType,
multi: true
}, defType);
visitor({
provide: ENVIRONMENT_INITIALIZER,
useValue: () => ɵɵinject(defType),
multi: true
}, defType);
}
const defProviders = injDef.providers;
if (defProviders != null && !isDuplicate) {
const injectorType = container;
deepForEachProvider(defProviders, provider => {
ngDevMode && validateProvider(provider, defProviders, injectorType);
visitor(provider, injectorType);
});
}
} else {
return false;
}
return defType !== container && container.providers !== undefined;
}
function validateProvider(provider, providers, containerType) {
if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) {
return;
}
const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
if (!classRef) {
throwInvalidProviderError(containerType, providers, provider);
}
}
function deepForEachProvider(providers, fn) {
for (let provider of providers) {
if (isEnvironmentProviders(provider)) {
provider = provider.ɵproviders;
}
if (Array.isArray(provider)) {
deepForEachProvider(provider, fn);
} else {
fn(provider);
}
}
}
const USE_VALUE = getClosureSafeProperty({
provide: String,
useValue: getClosureSafeProperty
});
function isValueProvider(value) {
return value !== null && typeof value == 'object' && USE_VALUE in value;
}
function isExistingProvider(value) {
return !!(value && value.useExisting);
}
function isFactoryProvider(value) {
return !!(value && value.useFactory);
}
function isTypeProvider(value) {
return typeof value === 'function';
}
function isClassProvider(value) {
return !!value.useClass;
}
const INJECTOR_SCOPE = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'Set Injector scope.' : '');
const NOT_YET = {};
const CIRCULAR = {};
let NULL_INJECTOR = undefined;
function getNullInjector() {
if (NULL_INJECTOR === undefined) {
NULL_INJECTOR = new NullInjector();
}
return NULL_INJECTOR;
}
class EnvironmentInjector {}
class R3Injector extends EnvironmentInjector {
parent;
source;
scopes;
records = new Map();
_ngOnDestroyHooks = new Set();
_onDestroyHooks = [];
get destroyed() {
return this._destroyed;
}
_destroyed = false;
injectorDefTypes;
constructor(providers, parent, source, scopes) {
super();
this.parent = parent;
this.source = source;
this.scopes = scopes;
forEachSingleProvider(providers, provider => this.processProvider(provider));
this.records.set(INJECTOR$1, makeRecord(undefined, this));
if (scopes.has('environment')) {
this.records.set(EnvironmentInjector, makeRecord(undefined, this));
}
const record = this.records.get(INJECTOR_SCOPE);
if (record != null && typeof record.value === 'string') {
this.scopes.add(record.value);
}
this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, {
self: true
}));
}
retrieve(token, options) {
const flags = convertToBitFlags(options) || 0;
try {
return this.get(token, THROW_IF_NOT_FOUND, flags);
} catch (e) {
if (isNotFound$1(e)) {
return e;
}
throw e;
}
}
destroy() {
assertNotDestroyed(this);
this._destroyed = true;
const prevConsumer = setActiveConsumer(null);
try {
for (const service of this._ngOnDestroyHooks) {
service.ngOnDestroy();
}
const onDestroyHooks = this._onDestroyHooks;
this._onDestroyHooks = [];
for (const hook of onDestroyHooks) {
hook();
}
} finally {
this.records.clear();
this._ngOnDestroyHooks.clear();
this.injectorDefTypes.clear();
setActiveConsumer(prevConsumer);
}
}
onDestroy(callback) {
assertNotDestroyed(this);
this._onDestroyHooks.push(callback);
return () => this.removeOnDestroy(callback);
}
runInContext(fn) {
assertNotDestroyed(this);
const previousInjector = setCurrentInjector(this);
const previousInjectImplementation = setInjectImplementation(undefined);
let prevInjectContext;
if (ngDevMode) {
prevInjectContext = setInjectorProfilerContext({
injector: this,
token: null
});
}
try {
return fn();
} finally {
setCurrentInjector(previousInjector);
setInjectImplementation(previousInjectImplementation);
ngDevMode && setInjectorProfilerContext(prevInjectContext);
}
}
get(token, notFoundValue = THROW_IF_NOT_FOUND, options) {
assertNotDestroyed(this);
if (Object.hasOwn(token, NG_ENV_ID)) {
return token[NG_ENV_ID](this);
}
const flags = convertToBitFlags(options);
let prevInjectContext;
if (ngDevMode) {
prevInjectContext = setInjectorProfilerContext({
injector: this,
token: token
});
}
const previousInjector = setCurrentInjector(this);
const previousInjectImplementation = setInjectImplementation(undefined);
try {
if (!(flags & 4)) {
let record = this.records.get(token);
if (record === undefined) {
const def = couldBeInjectableType(token) && getInjectableDef(token);
if (def && this.injectableDefInScope(def)) {
if (ngDevMode) {
runInInjectorProfilerContext(this, token, () => {
emitProviderConfiguredEvent(token);
});
}
record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);
} else {
record = null;
}
this.records.set(token, record);
}
if (record != null) {
return this.hydrate(token, record, flags);
}
}
const nextInjector = !(flags & 2) ? this.parent : getNullInjector();
notFoundValue = flags & 8 && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue;
return nextInjector.get(token, notFoundValue);
} catch (error) {
const errorCode = getRuntimeErrorCode(error);
if (errorCode === -200 || errorCode === -201) {
if (ngDevMode) {
prependTokenToDependencyPath(error, token);
if (previousInjector) {
throw error;
} else {
throw augmentRuntimeError(error, this.source);
}
} else {
throw new RuntimeError(errorCode, null);
}
} else {
throw error;
}
} finally {
setInjectImplementation(previousInjectImplementation);
setCurrentInjector(previousInjector);
ngDevMode && setInjectorProfilerContext(prevInjectContext);
}
}
resolveInjectorInitializers() {
const prevConsumer = setActiveConsumer(null);
const previousInjector = setCurrentInjector(this);
const previousInjectImplementation = setInjectImplementation(undefined);
let prevInjectContext;
if (ngDevMode) {
prevInjectContext = setInjectorProfilerContext({
injector: this,
token: null
});
}
try {
const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, {
self: true
});
if (ngDevMode && !Array.isArray(initializers)) {
throw new RuntimeError(-209, 'Unexpected type of the `ENVIRONMENT_INITIALIZER` token value ' + `(expected an array, but got ${typeof initializers}). ` + 'Please check that the `ENVIRONMENT_INITIALIZER` token is configured as a ' + '`multi: true` provider.');
}
for (const initializer of initializers) {
initializer();
}
} finally {
setCurrentInjector(previousInjector);
setInjectImplementation(previousInjectImplementation);
ngDevMode && setInjectorProfilerContext(prevInjectContext);
setActiveConsumer(prevConsumer);
}
}
toString() {
if (ngDevMode) {
const tokens = [];
const records = this.records;
for (const token of records.keys()) {
tokens.push(stringify(token));
}
return `R3Injector[${tokens.join(', ')}]`;
}
return 'R3Injector[...]';
}
processProvider(provider) {
provider = resolveForwardRef(provider);
let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);
const record = providerToRecord(provider);
if (ngDevMode) {
runInInjectorProfilerContext(this, token, () => {
if (isValueProvider(provider)) {
emitInjectorToCreateInstanceEvent(token);
emitInstanceCreatedByInjectorEvent(provider.useValue);
}
emitProviderConfiguredEvent(provider);
});
}
if (!isTypeProvider(provider) && provider.multi === true) {
let multiRecord = this.records.get(token);
if (multiRecord) {
if (ngDevMode && multiRecord.multi === undefined) {
throwMixedMultiProviderError();
}
} else {
multiRecord = makeRecord(undefined, NOT_YET, true);
multiRecord.factory = () => injectArgs(multiRecord.multi);
this.records.set(token, multiRecord);
}
token = provider;
multiRecord.multi.push(provider);
} else {
if (ngDevMode) {
const existing = this.records.get(token);
if (existing && existing.multi !== undefined) {
throwMixedMultiProviderError();
}
}
}
this.records.set(token, record);
}
hydrate(token, record, flags) {
const prevConsumer = setActiveConsumer(null);
try {
if (record.value === CIRCULAR) {
throw cyclicDependencyError(ngDevMode ? stringify(token) : '');
} else if (record.value === NOT_YET) {
record.value = CIRCULAR;
if (ngDevMode) {
runInInjectorProfilerContext(this, token, () => {
emitInjectorToCreateInstanceEvent(token);
record.value = record.factory(undefined, flags);
emitInstanceCreatedByInjectorEvent(record.value);
});
} else {
record.value = record.factory(undefined, flags);
}
}
if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) {
this._ngOnDestroyHooks.add(record.value);
}
return record.value;
} finally {
setActiveConsumer(prevConsumer);
}
}
injectableDefInScope(def) {
if (!def.providedIn) {
return false;
}
const providedIn = resolveForwardRef(def.providedIn);
if (typeof providedIn === 'string') {
return providedIn === 'any' || this.scopes.has(providedIn);
} else {
return this.injectorDefTypes.has(providedIn);
}
}
removeOnDestroy(callback) {
const destroyCBIdx = this._onDestroyHooks.indexOf(callback);
if (destroyCBIdx !== -1) {
this._onDestroyHooks.splice(destroyCBIdx, 1);
}
}
}
function injectableDefOrInjectorDefFactory(token) {
const injectableDef = getInjectableDef(token);
const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);
if (factory !== null) {
return factory;
}
if (token instanceof InjectionToken) {
throw new RuntimeError(-204, ngDevMode && `Token ${stringify(token)} is missing a ɵprov definition.`);
}
if (token instanceof Function) {
return getUndecoratedInjectableFactory(token);
}
throw new RuntimeError(-204, ngDevMode && 'unreachable');
}
function getUndecoratedInjectableFactory(token) {
const paramLength = token.length;
if (paramLength > 0) {
throw new RuntimeError(-204, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, '?').join(', ')}).`);
}
const inheritedInjectableDef = getInheritedInjectableDef(token);
if (inheritedInjectableDef !== null) {
return () => inheritedInjectableDef.factory(token);
} else {
return () => new token();
}
}
function providerToRecord(provider) {
if (isValueProvider(provider)) {
return makeRecord(undefined, provider.useValue);
} else {
const factory = providerToFactory(provider);
return makeRecord(factory, NOT_YET);
}
}
function providerToFactory(provider, ngModuleType, providers) {
let factory = undefined;
if (ngDevMode && isEnvironmentProviders(provider)) {
throwInvalidProviderError(undefined, providers, provider);
}
if (isTypeProvider(provider)) {
const unwrappedProvider = resolveForwardRef(provider);
return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);
} else {
if (isValueProvider(provider)) {
factory = () => resolveForwardRef(provider.useValue);
} else if (isFactoryProvider(provider)) {
factory = () => provider.useFactory(...injectArgs(provider.deps || []));
} else if (isExistingProvider(provider)) {
factory = (_, flags) => ɵɵinject(resolveForwardRef(provider.useExisting), flags !== undefined && flags & 8 ? 8 : undefined);
} else {
const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
if (ngDevMode && !classRef) {
throwInvalidProviderError(ngModuleType, providers, provider);
}
if (hasDeps(provider)) {
factory = () => new classRef(...injectArgs(provider.deps));
} else {
return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);
}
}
}
return factory;
}
function assertNotDestroyed(injector) {
if (injector.destroyed) {
throw new RuntimeError(-205, ngDevMode && 'Injector has already been destroyed.');
}
}
function makeRecord(factory, value, multi = false) {
return {
factory: factory,
value: value,
multi: multi ? [] : undefined
};
}
function hasDeps(value) {
return !!value.deps;
}
function hasOnDestroy(value) {
return value !== null && typeof value === 'object' && typeof value.ngOnDestroy === 'function';
}
function couldBeInjectableType(value) {
return typeof value === 'function' || typeof value === 'object' && value.ngMetadataName === 'InjectionToken';
}
function forEachSingleProvider(providers, fn) {
for (const provider of providers) {
if (Array.isArray(provider)) {
forEachSingleProvider(provider, fn);
} else if (provider && isEnvironmentProviders(provider)) {
forEachSingleProvider(provider.ɵproviders, fn);
} else {
fn(provider);
}
}
}
function runInInjectionContext(injector, fn) {
let internalInjector;
if (injector instanceof R3Injector) {
assertNotDestroyed(injector);
internalInjector = injector;
} else {
internalInjector = new RetrievingInjector(injector);
}
let prevInjectorProfilerContext;
if (ngDevMode) {
prevInjectorProfilerContext = setInjectorProfilerContext({
injector,
token: null
});
}
const prevInjector = setCurrentInjector(internalInjector);
const previousInjectImplementation = setInjectImplementation(undefined);
try {
return fn();
} finally {
setCurrentInjector(prevInjector);
ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext);
setInjectImplementation(previousInjectImplementation);
}
}
function isInInjectionContext() {
return getInjectImplementation() !== undefined || getCurrentInjector() != null;
}
function assertInInjectionContext(debugFn) {
if (!isInInjectionContext()) {
throw new RuntimeError(-203, ngDevMode && debugFn.name + '() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`');
}
}
const HOST = 0;
const TVIEW = 1;
const FLAGS = 2;
const PARENT = 3;
const NEXT = 4;
const T_HOST = 5;
const HYDRATION = 6;
const CLEANUP = 7;
const CONTEXT = 8;
const INJECTOR = 9;
const ENVIRONMENT = 10;
const RENDERER = 11;
const CHILD_HEAD = 12;
const CHILD_TAIL = 13;
const DECLARATION_VIEW = 14;
const DECLARATION_COMPONENT_VIEW = 15;
const DECLARATION_LCONTAINER = 16;
const PREORDER_HOOK_FLAGS = 17;
const QUERIES = 18;
const ID = 19;
const EMBEDDED_VIEW_INJECTOR = 20;
const ON_DESTROY_HOOKS = 21;
const EFFECTS_TO_SCHEDULE = 22;
const EFFECTS = 23;
const REACTIVE_TEMPLATE_CONSUMER = 24;
const AFTER_RENDER_SEQUENCES_TO_ADD = 25;
const ANIMATIONS = 26;
const HEADER_OFFSET = 27;
const TYPE = 1;
const DEHYDRATED_VIEWS = 6;
const NATIVE = 7;
const VIEW_REFS = 8;
const MOVED_VIEWS = 9;
const CONTAINER_HEADER_OFFSET = 10;
function isLView(value) {
return Array.isArray(value) && typeof value[TYPE] === 'object';
}
function isLContainer(value) {
return Array.isArray(value) && value[TYPE] === true;
}
function isContentQueryHost(tNode) {
return (tNode.flags & 4) !== 0;
}
function isComponentHost(tNode) {
return tNode.componentOffset > -1;
}
function isDirectiveHost(tNode) {
return (tNode.flags & 1) === 1;
}
function isComponentDef(def) {
return !!def.template;
}
function isRootView(target) {
return (target[FLAGS] & 512) !== 0;
}
function isProjectionTNode(tNode) {
return (tNode.type & 16) === 16;
}
function hasI18n(lView) {
return (lView[FLAGS] & 32) === 32;
}
function isDestroyed(lView) {
return (lView[FLAGS] & 256) === 256;
}
function assertTNodeForLView(tNode, lView) {
assertTNodeForTView(tNode, lView[TVIEW]);
}
function assertTNodeCreationIndex(lView, index) {
const adjustedIndex = index + HEADER_OFFSET;
assertIndexInRange(lView, adjustedIndex);
assertLessThan(adjustedIndex, lView[TVIEW].bindingStartIndex, 'TNodes should be created before any bindings');
}
function assertTNodeForTView(tNode, tView) {
assertTNode(tNode);
const tData = tView.data;
for (let i = HEADER_OFFSET; i < tData.length; i++) {
if (tData[i] === tNode) {
return;
}
}
throwError('This TNode does not belong to this TView.');
}
function assertTNode(tNode) {
assertDefined(tNode, 'TNode must be defined');
if (!(tNode && typeof tNode === 'object' && Object.hasOwn(tNode, 'directiveStylingLast'))) {
throwError('Not of type TNode, got: ' + tNode);
}
}
function assertTIcu(tIcu) {
assertDefined(tIcu, 'Expected TIcu to be defined');
if (!(typeof tIcu.currentCaseLViewIndex === 'number')) {
throwError('Object is not of TIcu type.');
}
}
function assertNgModuleType(actual, msg = "Type passed in is not NgModuleType, it does not have 'ɵmod' property.") {
if (!getNgModuleDef(actual)) {
throwError(msg);
}
}
function assertHasParent(tNode) {
assertDefined(tNode, 'currentTNode should exist!');
assertDefined(tNode.parent, 'currentTNode should have a parent');
}
function assertLContainer(value) {
assertDefined(value, 'LContainer must be defined');
assertEqual(isLContainer(value), true, 'Expecting LContainer');
}
function assertLViewOrUndefined(value) {
value && assertEqual(isLView(value), true, 'Expecting LView or undefined or null');
}
function assertLView(value) {
assertDefined(value, 'LView must be defined');
assertEqual(isLView(value), true, 'Expecting LView');
}
function assertFirstCreatePass(tView, errMessage) {
assertEqual(tView.firstCreatePass, true, errMessage || 'Should only be called in first create pass.');
}
function assertFirstUpdatePass(tView, errMessage) {
assertEqual(tView.firstUpdatePass, true, 'Should only be called in first update pass.');
}
function assertDirectiveDef(obj) {
if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) {
throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
}
}
function assertIndexInDeclRange(tView, index) {
assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
}
function assertIndexInExpandoRange(lView, index) {
const tView = lView[1];
assertBetween(tView.expandoStartIndex, lView.length, index);
}
function assertBetween(lower, upper, index) {
if (!(lower <= index && index < upper)) {
throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);
}
}
function assertProjectionSlots(lView, errMessage) {
assertDefined(lView[DECLARATION_COMPONENT_VIEW], 'Component views should exist.');
assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, 'Components with projection nodes (<ng-content>) must have projection slots defined.');
}
function assertParentView(lView, errMessage) {
assertDefined(lView, "Component views should always have a parent view (component's host view)");
}
function assertNodeInjector(lView, injectorIndex) {
assertIndexInExpandoRange(lView, injectorIndex);
assertIndexInExpandoRange(lView, injectorIndex + 8);
assertNumber(lView[injectorIndex + 0], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 1], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 2], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 3], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 4], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 5], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 6], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 7], 'injectorIndex should point to a bloom filter');
assertNumber(lView[injectorIndex + 8], 'injectorIndex should point to parent injector');
}
var SecurityContext;
(function (SecurityContext) {
SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
SecurityContext[SecurityContext["HTML"] = 1] = "HTML";
SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE";
SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
SecurityContext[SecurityContext["URL"] = 4] = "URL";
SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
SecurityContext[SecurityContext["ATTRIBUTE_NO_BINDING"] = 6] = "ATTRIBUTE_NO_BINDING";
})(SecurityContext || (SecurityContext = {}));
let _SECURITY_SCHEMA;
const SVG_NAMESPACE = 'svg';
const MATH_ML_NAMESPACE = 'math';
const NO_NAMESPACE = '';
const MATCH_ALL_ELEMENTS = '*';
const createNullObj = () => Object.create(null);
function SECURITY_SCHEMA() {
if (_SECURITY_SCHEMA) {
return _SECURITY_SCHEMA;
}
_SECURITY_SCHEMA = createNullObj();
registerContext(SecurityContext.HTML, undefined, [['iframe', ['srcdoc']], ['*', ['innerHTML', 'outerHTML']]]);
registerContext(SecurityContext.STYLE, undefined, [['*', ['style']]]);
registerContext(SecurityContext.URL, undefined, [['*', ['formAction']], ['area', ['href']], ['a', ['href', 'xlink:href']], ['form', ['action']], ['img', ['src']], ['video', ['src']]]);
registerContext(SecurityContext.URL, MATH_ML_NAMESPACE, [['*', ['href', 'xlink:href']]]);
registerContext(SecurityContext.RESOURCE_URL, undefined, [['base', ['href']], ['embed', ['src']], ['frame', ['src']], ['iframe', ['src']], ['link', ['href']], ['object', ['codebase', 'data']]]);
registerContext(SecurityContext.URL, SVG_NAMESPACE, [['a', ['href', 'xlink:href']]]);
registerContext(SecurityContext.ATTRIBUTE_NO_BINDING, SVG_NAMESPACE, [['animate', ['attributeName', 'values', 'to', 'from']], ['set', ['to', 'attributeName']], ['animateMotion', ['attributeName']], ['animateTransform', ['attributeName']]]);
registerContext(SecurityContext.ATTRIBUTE_NO_BINDING, undefined, [['unknown', ['attributeName', 'values', 'to', 'from', 'sandbox', 'allow', 'allowFullscreen', 'referrerPolicy', 'csp', 'fetchPriority', 'credentialless']], ['iframe', ['sandbox', 'allow', 'allowFullscreen', 'referrerPolicy', 'csp', 'fetchPriority', 'credentialless']]]);
return _SECURITY_SCHEMA;
}
function registerContext(ctx, namespace, specs) {
const nsKey = namespace ?? NO_NAMESPACE;
for (const [element, attributeNames] of specs) {
const tagName = element.toLowerCase();
for (const attr of attributeNames) {
const attrLower = attr.toLowerCase();
const attrSchema = _SECURITY_SCHEMA[attrLower] ??= createNullObj();
const nsSchema = attrSchema[nsKey] ??= createNullObj();
nsSchema[tagName] = ctx;
}
}
}
function checkSecurityContext(tagName, propName, namespace) {
const securitySchema = SECURITY_SCHEMA();
const attrSchema = securitySchema[propName.toLowerCase()];
if (!attrSchema) {
return SecurityContext.NONE;
}
const tagLower = tagName.toLowerCase();
let context;
if (namespace) {
const nsSchema = attrSchema[namespace];
if (nsSchema) {
context = nsSchema[tagLower] ?? nsSchema[MATCH_ALL_ELEMENTS];
}
}
if (context === undefined) {
const defaultSchema = attrSchema[NO_NAMESPACE];
if (defaultSchema) {
context = defaultSchema[tagLower] ?? defaultSchema[MATCH_ALL_ELEMENTS];
}
}
return context ?? SecurityContext.NONE;
}
function unwrapRNode(value) {
while (Array.isArray(value)) {
value = value[HOST];
}
return value;
}
function unwrapLView(value) {
while (Array.isArray(value)) {
if (typeof value[TYPE] === 'object') return value;
value = value[HOST];
}
return null;
}
function getNativeByIndex(index, lView) {
ngDevMode && assertIndexInRange(lView, index);
ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Expected to be past HEADER_OFFSET');
return unwrapRNode(lView[index]);
}
function getNativeByTNode(tNode, lView) {
ngDevMode && assertTNodeForLView(tNode, lView);
ngDevMode && assertIndexInRange(lView, tNode.index);
const node = unwrapRNode(lView[tNode.index]);
return node;
}
function getNativeByTNodeOrNull(tNode, lView) {
const index = tNode === null ? -1 : tNode.index;
if (index !== -1) {
ngDevMode && assertTNodeForLView(tNode, lView);
const node = unwrapRNode(lView[index]);
return node;
}
return null;
}
function getTNode(tView, index) {
ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
ngDevMode && assertLessThan(index, tView.data.length, 'wrong index for TNode');
const tNode = tView.data[index];
ngDevMode && tNode !== null && assertTNode(tNode);
return tNode;
}
function load(view, index) {
ngDevMode && assertIndexInRange(view, index);
return view[index];
}
function store(tView, lView, index, value) {
if (index >= tView.data.length) {
tView.data[index] = null;
tView.blueprint[index] = null;
}
lView[index] = value;
}
function getComponentLViewByIndex(nodeIndex, hostView) {
ngDevMode && assertIndexInRange(hostView, nodeIndex);
const slotValue = hostView[nodeIndex];
const lView = isLView(slotValue) ? slotValue : slotValue[HOST];
return lView;
}
function isCreationMode(view) {
return (view[FLAGS] & 4) === 4;
}
function viewAttachedToChangeDetector(view) {
return (view[FLAGS] & 128) === 128;
}
function viewAttachedToContainer(view) {
return isLContainer(view[PARENT]);
}
function getConstant(consts, index) {
if (index === null || index === undefined) return null;
ngDevMode && assertIndexInRange(consts, index);
return consts[index];
}
function resetPreOrderHookFlags(lView) {
lView[PREORDER_HOOK_FLAGS] = 0;
}
function markViewForRefresh(lView) {
if (lView[FLAGS] & 1024) {
return;
}
lView[FLAGS] |= 1024;
if (viewAttachedToChangeDetector(lView)) {
markAncestorsForTraversal(lView);
}
}
function walkUpViews(nestingLevel, currentView) {
while (nestingLevel > 0) {
ngDevMode && assertDefined(currentView[DECLARATION_VIEW], 'Declaration view should be defined if nesting level is greater than 0.');
currentView = currentView[DECLARATION_VIEW];
nestingLevel--;
}
return currentView;
}
function requiresRefreshOrTraversal(lView) {
return !!(lView[FLAGS] & (1024 | 8192) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty);
}
function updateAncestorTraversalFlagsOnAttach(lView) {
lView[ENVIRONMENT].changeDetectionScheduler?.notify(8);
if (lView[FLAGS] & 64) {
lView[FLAGS] |= 1024;
}
if (requiresRefreshOrTraversal(lView)) {
markAncestorsForTraversal(lView);
}
}
function markAncestorsForTraversal(lView) {
lView[ENVIRONMENT].changeDetectionScheduler?.notify(0);
let parent = getLViewParent(lView);
while (parent !== null) {
if (parent[FLAGS] & 8192) {
break;
}
parent[FLAGS] |= 8192;
if (!viewAttachedToChangeDetector(parent)) {
break;
}
parent = getLViewParent(parent);
}
}
function storeLViewOnDestroy(lView, onDestroyCallback) {
if (isDestroyed(lView)) {
throw new RuntimeError(911, ngDevMode && 'View has already been destroyed.');
}
if (lView[ON_DESTROY_HOOKS] === null) {
lView[ON_DESTROY_HOOKS] = [];
}
lView[ON_DESTROY_HOOKS].push(onDestroyCallback);
}
function removeLViewOnDestroy(lView, onDestroyCallback) {
if (lView[ON_DESTROY_HOOKS] === null) return;
const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback);
if (destroyCBIdx !== -1) {
lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1);
}
}
function getLViewParent(lView) {
ngDevMode && assertLView(lView);
const parent = lView[PARENT];
return isLContainer(parent) ? parent[PARENT] : parent;
}
function getOrCreateLViewCleanup(view) {
return view[CLEANUP] ??= [];
}
function getOrCreateTViewCleanup(tView) {
return tView.cleanup ??= [];
}
function storeCleanupWithContext(tView, lView, context, cleanupFn) {
const lCleanup = getOrCreateLViewCleanup(lView);
ngDevMode && assertDefined(context, 'Cleanup context is mandatory when registering framework-level destroy hooks');
lCleanup.push(context);
if (tView.firstCreatePass) {
getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
} else {
if (ngDevMode) {
Object.freeze(getOrCreateTViewCleanup(tView));
}
}
}
const instructionState = {
lFrame: createLFrame(null),
bindingsEnabled: true,
skipHydrationRootTNode: null
};
var CheckNoChangesMode;
(function (CheckNoChangesMode) {
CheckNoChangesMode[CheckNoChangesMode["Off"] = 0] = "Off";
CheckNoChangesMode[CheckNoChangesMode["Exhaustive"] = 1] = "Exhaustive";
CheckNoChangesMode[CheckNoChangesMode["OnlyDirtyViews"] = 2] = "OnlyDirtyViews";
})(CheckNoChangesMode || (CheckNoChangesMode = {}));
let _checkNoChangesMode = 0;
let _isRefreshingViews = false;
function getElementDepthCount() {
return instructionState.lFrame.elementDepthCount;
}
function increaseElementDepthCount() {
instructionState.lFrame.elementDepthCount++;
}
function decreaseElementDepthCount() {
instructionState.lFrame.elementDepthCount--;
}
function getBindingsEnabled() {
return instructionState.bindingsEnabled;
}
function isInSkipHydrationBlock() {
return instructionState.skipHydrationRootTNode !== null;
}
function isSkipHydrationRootTNode(tNode) {
return instructionState.skipHydrationRootTNode === tNode;
}
function ɵɵenableBindings() {
instructionState.bindingsEnabled = true;
}
function enterSkipHydrationBlock(tNode) {
instructionState.skipHydrationRootTNode = tNode;
}
function ɵɵdisableBindings() {
instructionState.bindingsEnabled = false;
}
function leaveSkipHydrationBlock() {
instructionState.skipHydrationRootTNode = null;
}
function getLView() {
return instructionState.lFrame.lView;
}
function getTView() {
return instructionState.lFrame.tView;
}
function ɵɵrestoreView(viewToRestore) {
instructionState.lFrame.contextLView = viewToRestore;
return viewToRestore[CONTEXT];
}
function ɵɵresetView(value) {
instructionState.lFrame.contextLView = null;
return value;
}
function getCurrentTNode() {
let currentTNode = getCurrentTNodePlaceholderOk();
while (currentTNode !== null && currentTNode.type === 64) {
currentTNode = currentTNode.parent;
}
return currentTNode;
}
function getCurrentTNodePlaceholderOk() {
return instructionState.lFrame.currentTNode;
}
function getCurrentParentTNode() {
const lFrame = instructionState.lFrame;
const currentTNode = lFrame.currentTNode;
return lFrame.isParent ? currentTNode : currentTNode.parent;
}
function setCurrentTNode(tNode, isParent) {
ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
const lFrame = instructionState.lFrame;
lFrame.currentTNode = tNode;
lFrame.isParent = isParent;
}
function isCurrentTNodeParent() {
return instructionState.lFrame.isParent;
}
function setCurrentTNodeAsNotParent() {
instructionState.lFrame.isParent = false;
}
function getContextLView() {
const contextLView = instructionState.lFrame.contextLView;
ngDevMode && assertDefined(contextLView, 'contextLView must be defined.');
return contextLView;
}
function isInCheckNoChangesMode() {
!ngDevMode && throwError('Must never be called in production mode');
return _checkNoChangesMode !== CheckNoChangesMode.Off;
}
function isExhaustiveCheckNoChanges() {
!ngDevMode && throwError('Must never be called in production mode');
return _checkNoChangesMode === CheckNoChangesMode.Exhaustive;
}
function setIsInCheckNoChangesMode(mode) {
!ngDevMode && throwError('Must never be called in production mode');
_checkNoChangesMode = mode;
}
function isRefreshingViews() {
return _isRefreshingViews;
}
function setIsRefreshingViews(mode) {
const prev = _isRefreshingViews;
_isRefreshingViews = mode;
return prev;
}
function getBindingRoot() {
const lFrame = instructionState.lFrame;
let index = lFrame.bindingRootIndex;
if (index === -1) {
index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;
}
return index;
}
function getBindingIndex() {
return instructionState.lFrame.bindingIndex;
}
function setBindingIndex(value) {
return instructionState.lFrame.bindingIndex = value;
}
function nextBindingIndex() {
return instructionState.lFrame.bindingIndex++;
}
function incrementBindingIndex(count) {
const lFrame = instructionState.lFrame;
const index = lFrame.bindingIndex;
lFrame.bindingIndex = lFrame.bindingIndex + count;
return index;
}
function isInI18nBlock() {
return instructionState.lFrame.inI18n;
}
function setInI18nBlock(isInI18nBlock) {
instructionState.lFrame.inI18n = isInI18nBlock;
}
function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
const lFrame = instructionState.lFrame;
lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
setCurrentDirectiveIndex(currentDirectiveIndex);
}
function getCurrentDirectiveIndex() {
return instructionState.lFrame.currentDirectiveIndex;
}
function setCurrentDirectiveIndex(currentDirectiveIndex) {
instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
}
function getCurrentDirectiveDef(tData) {
const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
}
function getCurrentQueryIndex() {
return instructionState.lFrame.currentQueryIndex;
}
function setCurrentQueryIndex(value) {
instructionState.lFrame.currentQueryIndex = value;
}
function getDeclarationTNode(lView) {
const tView = lView[TVIEW];
if (tView.type === 2) {
ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
return tView.declTNode;
}
if (tView.type === 1) {
return lView[T_HOST];
}
return null;
}
function enterDI(lView, tNode, flags) {
ngDevMode && assertLViewOrUndefined(lView);
if (flags & 4) {
ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);
let parentTNode = tNode;
let parentLView = lView;
while (true) {
ngDevMode && assertDefined(parentTNode, 'Parent TNode should be defined');
parentTNode = parentTNode.parent;
if (parentTNode === null && !(flags & 1)) {
parentTNode = getDeclarationTNode(parentLView);
if (parentTNode === null) break;
ngDevMode && assertDefined(parentLView, 'Parent LView should be defined');
parentLView = parentLView[DECLARATION_VIEW];
if (parentTNode.type & (2 | 8)) {
break;
}
} else {
break;
}
}
if (parentTNode === null) {
return false;
} else {
tNode = parentTNode;
lView = parentLView;
}
}
ngDevMode && assertTNodeForLView(tNode, lView);
const lFrame = instructionState.lFrame = allocLFrame();
lFrame.currentTNode = tNode;
lFrame.lView = lView;
return true;
}
function enterView(newView) {
ngDevMode && assertNotEqual(newView[0], newView[1], '????');
ngDevMode && assertLViewOrUndefined(newView);
const newLFrame = allocLFrame();
if (ngDevMode) {
assertEqual(newLFrame.isParent, true, 'Expected clean LFrame');
assertEqual(newLFrame.lView, null, 'Expected clean LFrame');
assertEqual(newLFrame.tView, null, 'Expected clean LFrame');
assertEqual(newLFrame.selectedIndex, -1, 'Expected clean LFrame');
assertEqual(newLFrame.elementDepthCount, 0, 'Expected clean LFrame');
assertEqual(newLFrame.currentDirectiveIndex, -1, 'Expected clean LFrame');
assertEqual(newLFrame.currentNamespace, null, 'Expected clean LFrame');
assertEqual(newLFrame.bindingRootIndex, -1, 'Expected clean LFrame');
assertEqual(newLFrame.currentQueryIndex, 0, 'Expected clean LFrame');
}
const tView = newView[TVIEW];
instructionState.lFrame = newLFrame;
ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
newLFrame.currentTNode = tView.firstChild;
newLFrame.lView = newView;
newLFrame.tView = tView;
newLFrame.contextLView = newView;
newLFrame.bindingIndex = tView.bindingStartIndex;
newLFrame.inI18n = false;
}
function allocLFrame() {
const currentLFrame = instructionState.lFrame;
const childLFrame = currentLFrame === null ? null : currentLFrame.child;
const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;
return newLFrame;
}
function createLFrame(parent) {
const lFrame = {
currentTNode: null,
isParent: true,
lView: null,
tView: null,
selectedIndex: -1,
contextLView: null,
elementDepthCount: 0,
currentNamespace: null,
currentDirectiveIndex: -1,
bindingRootIndex: -1,
bindingIndex: -1,
currentQueryIndex: 0,
parent: parent,
child: null,
inI18n: false
};
parent !== null && (parent.child = lFrame);
return lFrame;
}
function leaveViewLight() {
const oldLFrame = instructionState.lFrame;
instructionState.lFrame = oldLFrame.parent;
oldLFrame.currentTNode = null;
oldLFrame.lView = null;
return oldLFrame;
}
const leaveDI = leaveViewLight;
function leaveView() {
const oldLFrame = leaveViewLight();
oldLFrame.isParent = true;
oldLFrame.tView = null;
oldLFrame.selectedIndex = -1;
oldLFrame.contextLView = null;
oldLFrame.elementDepthCount = 0;
oldLFrame.currentDirectiveIndex = -1;
oldLFrame.currentNamespace = null;
oldLFrame.bindingRootIndex = -1;
oldLFrame.bindingIndex = -1;
oldLFrame.currentQueryIndex = 0;
}
function nextContextImpl(level) {
const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView);
return contextLView[CONTEXT];
}
function getSelectedIndex() {
return instructionState.lFrame.selectedIndex;
}
function setSelectedIndex(index) {
ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Index must be past HEADER_OFFSET (or -1).');
ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, "Can't set index passed end of LView");
instructionState.lFrame.selectedIndex = index;
}
function getSelectedTNode() {
const lFrame = instructionState.lFrame;
return getTNode(lFrame.tView, lFrame.selectedIndex);
}
function ɵɵnamespaceSVG() {
instructionState.lFrame.currentNamespace = SVG_NAMESPACE;
}
function ɵɵnamespaceMathML() {
instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;
}
function ɵɵnamespaceHTML() {
namespaceHTMLInternal();
}
function namespaceHTMLInternal() {
instructionState.lFrame.currentNamespace = null;
}
function getNamespace() {
return instructionState.lFrame.currentNamespace;
}
let _wasLastNodeCreated = true;
function wasLastNodeCreated() {
return _wasLastNodeCreated;
}
function lastNodeWasCreated(flag) {
_wasLastNodeCreated = flag;
}
function promiseWithResolvers() {
let resolve;
let reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return {
promise,
resolve,
reject
};
}
function createInjector(defType, parent = null, additionalProviders = null, name) {
const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);
injector.resolveInjectorInitializers();
return injector;
}
function createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name, scopes = new Set()) {
const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)];
let source = undefined;
if (ngDevMode) {
source = name || (typeof defType === 'object' ? undefined : stringify(defType));
}
return new R3Injector(providers, parent || getNullInjector(), source || null, scopes);
}
const specialProviders = new Set();
function registerSpecialProvider(clazz) {
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
specialProviders.add(clazz);
}
}
function getAllSpecialProviders() {
return specialProviders;
}
class Injector {
static THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
static NULL = new NullInjector();
static create(options, parent) {
if (Array.isArray(options)) {
return createInjector({
name: ''
}, parent, options, '');
} else {
const name = options.name ?? '';
return createInjector({
name
}, options.parent, options.providers, name);
}
}
static ɵprov =
/* @__PURE__ */
ɵɵdefineInjectable({
token: Injector,
providedIn: 'any',
factory: () => ɵɵinject(INJECTOR$1)
});
static __NG_ELEMENT_ID__ = -1;
}
if (typeof ngDevMode === 'undefined' || ngDevMode) {
registerSpecialProvider(Injector);
}
const DOCUMENT = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'DocumentToken' : '');
class DestroyRef {
static __NG_ELEMENT_ID__ = injectDestroyRef;
static __NG_ENV_ID__ = injector => injector;
}
if (typeof ngDevMode === 'undefined' || ngDevMode) {
registerSpecialProvider(DestroyRef);
}
class NodeInjectorDestroyRef extends DestroyRef {
_lView;
constructor(_lView) {
super();
this._lView = _lView;
}
get destroyed() {
return isDestroyed(this._lView);
}
onDestroy(callback) {
const lView = this._lView;
storeLViewOnDestroy(lView, callback);
return () => removeLViewOnDestroy(lView, callback);
}
}
function injectDestroyRef() {
return new NodeInjectorDestroyRef(getLView());
}
const SCHEDULE_IN_ROOT_ZONE_DEFAULT = false;
const DEBUG_TASK_TRACKER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'DEBUG_TASK_TRACKER' : '');
class PendingTasksInternal {
taskId = 0;
pendingTasks = new Set();
destroyed = false;
pendingTask = new BehaviorSubject(false);
debugTaskTracker = inject(DEBUG_TASK_TRACKER, {
optional: true
});
get hasPendingTasks() {
return this.destroyed ? false : this.pendingTask.value;
}
get hasPendingTasksObservable() {
if (this.destroyed) {
return new Observable(subscriber => {
subscriber.next(false);
subscriber.complete();
});
}
return this.pendingTask;
}
add() {
if (!this.hasPendingTasks && !this.destroyed) {
this.pendingTask.next(true);
}
const taskId = this.taskId++;
this.pendingTasks.add(taskId);
this.debugTaskTracker?.add(taskId);
return taskId;
}
has(taskId) {
return this.pendingTasks.has(taskId);
}
remove(taskId) {
this.pendingTasks.delete(taskId);
this.debugTaskTracker?.remove(taskId);
if (this.pendingTasks.size === 0 && this.hasPendingTasks) {
this.pendingTask.next(false);
}
}
ngOnDestroy() {
this.pendingTasks.clear();
if (this.hasPendingTasks) {
this.pendingTask.next(false);
}
this.destroyed = true;
this.pendingTask.unsubscribe();
}
static ɵprov =
/* @__PURE__ */
ɵɵdefineInjectable({
token: PendingTasksInternal,
providedIn: 'root',
factory: () => new PendingTasksInternal()
});
}
class EventEmitter_ extends Subject {
__isAsync;
destroyRef = undefined;
pendingTasks = undefined;
constructor(isAsync = false) {
super();
this.__isAsync = isAsync;
if (isInInjectionContext()) {
this.destroyRef = inject(DestroyRef, {
optional: true
}) ?? undefined;
this.pendingTasks = inject(PendingTasksInternal, {
optional: true
}) ?? undefined;
}
}
emit(value) {
const prevConsumer = setActiveConsumer$1(null);
try {
super.next(value);
} finally {
setActiveConsumer$1(prevConsumer);
}
}
subscribe(observerOrNext, error, complete) {
let nextFn = observerOrNext;
let errorFn = error || (() => null);
let completeFn = complete;
if (observerOrNext && typeof observerOrNext === 'object') {
const observer = observerOrNext;
nextFn = observer.next?.bind(observer);
errorFn = observer.error?.bind(observer);
completeFn = observer.complete?.bind(observer);
}
if (this.__isAsync) {
errorFn = this.wrapInTimeout(errorFn);
if (nextFn) {
nextFn = this.wrapInTimeout(nextFn);
}
if (completeFn) {
completeFn = this.wrapInTimeout(completeFn);
}
}
const sink = super.subscribe({
next: nextFn,
error: errorFn,
complete: completeFn
});
if (observerOrNext instanceof Subscription) {
observerOrNext.add(sink);
}
return sink;
}
wrapInTimeout(fn) {
return value => {
const taskId = this.pendingTasks?.add();
setTimeout(() => {
try {
fn(value);
} finally {
if (taskId !== undefined) {
this.pendingTasks?.remove(taskId);
}
}
});
};
}
}
const EventEmitter = EventEmitter_;
function noop(...args) {}
function scheduleCallbackWithRafRace(callback) {
let timeoutId;
let animationFrameId;
function cleanup() {
callback = noop;
try {
if (animationFrameId !== undefined && typeof cancelAnimationFrame === 'function') {
cancelAnimationFrame(animationFrameId);
}
if (timeoutId !== undefined) {
clearTimeout(timeoutId);
}
} catch {}
}
timeoutId = setTimeout(() => {
callback();
cleanup();
});
if (typeof requestAnimationFrame === 'function') {
animationFrameId = requestAnimationFrame(() => {
callback();
cleanup();
});
}
return () => cleanup();
}
function scheduleCallbackWithMicrotask(callback) {
queueMicrotask(() => callback());
return () => {
callback = noop;
};
}
class AsyncStackTaggingZoneSpec {
createTask;
constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {
this.name = 'asyncStackTagging for ' + namePrefix;
this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null);
}
name;
onScheduleTask(delegate, _current, target, task) {
task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);
return delegate.scheduleTask(target, task);
}
onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {
let ret;
if (task.consoleTask) {
ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));
} else {
ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);
}
return ret;
}
}
const isAngularZoneProperty = 'isAngularZone';
const angularZoneInstanceIdProperty = isAngularZoneProperty + '_ID';
let ngZoneInstanceId = 0;
class NgZone {
hasPendingMacrotasks = false;
hasPendingMicrotasks = false;
isStable = true;
onUnstable = new EventEmitter(false);
onMicrotaskEmpty = new EventEmitter(false);
onStable = new EventEmitter(false);
onError = new EventEmitter(false);
constructor(options) {
const {
enableLongStackTrace = false,
shouldCoalesceEventChangeDetection = false,
shouldCoalesceRunChangeDetection = false,
scheduleInRootZone = SCHEDULE_IN_ROOT_ZONE_DEFAULT
} = options;
if (typeof Zone == 'undefined') {
throw new RuntimeError(908, ngDevMode && `In this configuration Angular requires Zone.js`);
}
Zone.assertZonePatched();
const self = this;
self._nesting = 0;
self._outer = self._inner = Zone.current;
if (ngDevMode) {
self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular'));
}
if (Zone['TaskTrackingZoneSpec']) {
self._inner = self._inner.fork(new Zone['TaskTrackingZoneSpec']());
}
if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
self._inner = self._inner.fork(Zone['longStackTraceZoneSpec']);
}
self.shouldCoalesceEventChangeDetection = !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection;
self.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection;
self.callbackScheduled = false;
self.scheduleInRootZone = scheduleInRootZone;
forkInnerZoneWithAngularBehavior(self);
}
static isInAngularZone() {
return typeof Zone !== 'undefined' && Zone.current.get(isAngularZoneProperty) === true;
}
static assertInAngularZone() {
if (!NgZone.isInAngularZone()) {
throw new RuntimeError(909, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
}
}
static assertNotInAngularZone() {
if (NgZone.isInAngularZone()) {
throw new RuntimeError(909, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
}
}
run(fn, applyThis, applyArgs) {
return this._inner.run(fn, applyThis, applyArgs);
}
runTask(fn, applyThis, applyArgs, name) {
const zone = this._inner;
const task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);
try {
return zone.runTask(task, applyThis, applyArgs);
} finally {
zone.cancelTask(task);
}
}
runGuarded(fn, applyThis, applyArgs) {
return this._inner.runGuarded(fn, applyThis, applyArgs);
}
runOutsideAngular(fn) {
return this._outer.run(fn);
}
}
const EMPTY_PAYLOAD = {};
function checkStable(zone) {
if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
try {
zone._nesting++;
zone.onMicrotaskEmpty.emit(null);
} finally {
zone._nesting--;
if (!zone.hasPendingMicrotasks) {
try {
zone.runOutsideAngular(() => zone.onStable.emit(null));
} finally {
zone.isStable = true;
}
}
}
}
}
function delayChangeDetectionForEvents(zone) {
if (zone.isCheckStableRunning || zone.callbackScheduled) {
return;
}
zone.callbackScheduled = true;
function scheduleCheckStable() {
scheduleCallbackWithRafRace(() => {
zone.callbackScheduled = false;
updateMicroTaskStatus(zone);
zone.isCheckStableRunning = true;
checkStable(zone);
zone.isCheckStableRunning = false;
});
}
if (zone.scheduleInRootZone) {
Zone.root.run(() => {
scheduleCheckStable();
});
} else {
zone._outer.run(() => {
scheduleCheckStable();
});
}
updateMicroTaskStatus(zone);
}
function forkInnerZoneWithAngularBehavior(zone) {
const delayChangeDetectionForEventsDelegate = () => {
delayChangeDetectionForEvents(zone);
};
const instanceId = ngZoneInstanceId++;
zone._inner = zone._inner.fork({
name: 'angular',
properties: {
[isAngularZoneProperty]: true,
[angularZoneInstanceIdProperty]: instanceId,
[angularZoneInstanceIdProperty + instanceId]: true
},
onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
if (shouldBeIgnoredByZone(applyArgs)) {
return delegate.invokeTask(target, task, applyThis, applyArgs);
}
try {
onEnter(zone);
return delegate.invokeTask(target, task, applyThis, applyArgs);
} finally {
if (zone.shouldCoalesceEventChangeDetection && task.type === 'eventTask' || zone.shouldCoalesceRunChangeDetection) {
delayChangeDetectionForEventsDelegate();
}
onLeave(zone);
}
},
onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
try {
onEnter(zone);
return delegate.invoke(target, callback, applyThis, applyArgs, source);
} finally {
if (zone.shouldCoalesceRunChangeDetection && !zone.callbackScheduled && !isSchedulerTick(applyArgs)) {
delayChangeDetectionForEventsDelegate();
}
onLeave(zone);
}
},
onHasTask: (delegate, current, target, hasTaskState) => {
delegate.hasTask(target, hasTaskState);
if (current === target) {
if (hasTaskState.change == 'microTask') {
zone._hasPendingMicrotasks = hasTaskState.microTask;
updateMicroTaskStatus(zone);
checkStable(zone);
} else if (hasTaskState.change == 'macroTask') {
zone.hasPendingMacrotasks = hasTaskState.macroTask;
}
}
},
onHandleError: (delegate, current, target, error) => {
delegate.handleError(target, error);
zone.runOutsideAngular(() => zone.onError.emit(error));
return false;
}
});
}
function updateMicroTaskStatus(zone) {
if (zone._hasPendingMicrotasks || (zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) && zone.callbackScheduled === true) {
zone.hasPendingMicrotasks = true;
} else {
zone.hasPendingMicrotasks = false;
}
}
function onEnter(zone) {
zone._nesting++;
if (zone.isStable) {
zone.isStable = false;
zone.onUnstable.emit(null);
}
}
function onLeave(zone) {
zone._nesting--;
checkStable(zone);
}
class NoopNgZone {
hasPendingMicrotasks = false;
hasPendingMacrotasks = false;
isStable = true;
onUnstable = new EventEmitter();
onMicrotaskEmpty = new EventEmitter();
onStable = new EventEmitter();
onError = new EventEmitter();
run(fn, applyThis, applyArgs) {
return fn.apply(applyThis, applyArgs);
}
runGuarded(fn, applyThis, applyArgs) {
return fn.apply(applyThis, applyArgs);
}
runOutsideAngular(fn) {
return fn();
}
runTask(fn, applyThis, applyArgs, name) {
return fn.apply(applyThis, applyArgs);
}
}
function shouldBeIgnoredByZone(applyArgs) {
return hasApplyArgsData(applyArgs, '__ignore_ng_zone__');
}
function isSchedulerTick(applyArgs) {
return hasApplyArgsData(applyArgs, '__scheduler_tick__');
}
function hasApplyArgsData(applyArgs, key) {
if (!Array.isArray(applyArgs)) {
return false;
}
if (applyArgs.length !== 1) {
return false;
}
return applyArgs[0]?.data?.[key] === true;
}
class ErrorHandler {
_console = console;
handleError(error) {
this._console.error('ERROR', error);
}
}
const INTERNAL_APPLICATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'internal error handler' : '', {
factory: () => {
const zone = inject(NgZone);
const injector = inject(EnvironmentInjector);
let userErrorHandler;
return e => {
zone.runOutsideAngular(() => {
if (injector.destroyed && !userErrorHandler) {
setTimeout(() => {
throw e;
});
} else {
userErrorHandler ??= injector.get(ErrorHandler);
userErrorHandler.handleError(e);
}
});
};
}
});
const errorHandlerEnvironmentInitializer = {
provide: ENVIRONMENT_INITIALIZER,
useValue: () => {
const handler = inject(ErrorHandler, {
optional: true
});
if ((typeof ngDevMode === 'undefined' || ngDevMode) && handler === null) {
throw new RuntimeError(402, `A required Injectable was not found in the dependency injection tree. ` + 'If you are bootstrapping an NgModule, make sure that the `BrowserModule` is imported.');
}
},
multi: true
};
const globalErrorListeners = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'GlobalErrorListeners' : '', {
factory: () => {
if (typeof ngServerMode !== 'undefined' && ngServerMode) {
return;
}
const window = inject(DOCUMENT).defaultView;
if (!window) {
return;
}
const errorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
const rejectionListener = e => {
errorHandler(e.reason);
e.preventDefault();
};
const errorListener = e => {
if (e.error) {
errorHandler(e.error);
} else {
errorHandler(new Error(ngDevMode ? `An ErrorEvent with no error occurred. See Error.cause for details: ${e.message}` : e.message, {
cause: e
}));
}
e.preventDefault();
};
const setupEventListeners = () => {
window.addEventListener('unhandledrejection', rejectionListener);
window.addEventListener('error', errorListener);
};
if (typeof Zone !== 'undefined') {
Zone.root.run(setupEventListeners);
} else {
setupEventListeners();
}
inject(DestroyRef).onDestroy(() => {
window.removeEventListener('error', errorListener);
window.removeEventListener('unhandledrejection', rejectionListener);
});
}
});
function provideBrowserGlobalErrorListeners() {
return makeEnvironmentProviders([provideEnvironmentInitializer(() => void inject(globalErrorListeners))]);
}
function ɵunwrapWritableSignal(value) {
return null;
}
function signal(initialValue, options) {
const [get, set, update] = createSignal(initialValue, options?.equal);
const signalFn = get;
const node = signalFn[SIGNAL];
signalFn.set = set;
signalFn.update = update;
signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn);
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
const debugName = options?.debugName;
node.debugName = debugName;
signalFn.toString = () => `[Signal${debugName ? ' (' + debugName + ')' : ''}: ${signalFn()}]`;
}
return signalFn;
}
function signalAsReadonlyFn() {
const node = this[SIGNAL];
if (node.readonlyFn === undefined) {
const readonlyFn = () => this();
readonlyFn[SIGNAL] = node;
node.readonlyFn = readonlyFn;
}
return node.readonlyFn;
}
const APP_ID = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'AppId' : '', {
factory: () => DEFAULT_APP_ID
});
const DEFAULT_APP_ID = 'ng';
const validAppIdInitializer = {
provide: ENVIRONMENT_INITIALIZER,
multi: true,
useValue: () => {
const appId = inject(APP_ID);
const isAlphanumeric = /^[a-zA-Z0-9\-_]+$/.test(appId);
if (!isAlphanumeric) {
throw new RuntimeError(211, `APP_ID value "${appId}" is not alphanumeric. ` + `The APP_ID must be a string of alphanumeric characters. (a-zA-Z0-9), hyphens (-) and underscores (_) are allowed.`);
}
}
};
const PLATFORM_INITIALIZER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'Platform Initializer' : '');
const PLATFORM_ID = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'Platform ID' : '', {
providedIn: 'platform',
factory: () => 'unknown'
});
const ANIMATION_MODULE_TYPE = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'AnimationModuleType' : '');
const CSP_NONCE = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'CSP nonce' : '', {
factory: () => {
return inject(DOCUMENT).body?.querySelector('[ngCspNonce]')?.getAttribute('ngCspNonce') || null;
}
});
const IMAGE_CONFIG_DEFAULTS = {
breakpoints: [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840],
placeholderResolution: 30,
disableImageSizeWarning: false,
disableImageLazyLoadWarning: false
};
const IMAGE_CONFIG = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'ImageConfig' : '', {
factory: () => IMAGE_CONFIG_DEFAULTS
});
function makeStateKey(key) {
return key;
}
class TransferState {
static ɵprov =
/* @__PURE__ */
ɵɵdefineInjectable({
token: TransferState,
providedIn: 'root',
factory: () => {
const transferState = new TransferState();
if (typeof ngServerMode === 'undefined' || !ngServerMode) {
transferState.store = retrieveTransferredState(inject(DOCUMENT), inject(APP_ID));
}
return transferState;
}
});
store = {};
onSerializeCallbacks = {};
get(key, defaultValue) {
return this.store[key] !== undefined ? this.store[key] : defaultValue;
}
set(key, value) {
this.store[key] = value;
}
remove(key) {
delete this.store[key];
}
hasKey(key) {
return Object.hasOwn(this.store, key);
}
get isEmpty() {
return Object.keys(this.store).length === 0;
}
onSerialize(key, callback) {
this.onSerializeCallbacks[key] = callback;
}
toJson() {
for (const key in this.onSerializeCallbacks) {
if (Object.hasOwn(this.onSerializeCallbacks, key)) {
try {
this.store[key] = this.onSerializeCallbacks[key]();
} catch (e) {
console.warn('Exception in onSerialize callback: ', e);
}
}
}
return JSON.stringify(this.store).replace(/</g, '\\u003C').replace(/\//g, '\\u002F');
}
}
function retrieveTransferredState(doc, appId) {
const script = doc.getElementById(appId + '-state');
if (script?.tagName === 'SCRIPT' && script.textContent) {
try {
return JSON.parse(script.textContent);
} catch (e) {
console.warn('Exception while restoring TransferState for app ' + appId, e);
}
}
return {};
}
function assertNotInReactiveContext(debugFn, extraContext) {
if (getActiveConsumer() !== null) {
throw new RuntimeError(-602, ngDevMode && `${debugFn.name}() cannot be called from within a reactive context.${extraContext ? ` ${extraContext}` : ''}`);
}
}
class ViewContext {
view;
node;
constructor(view, node) {
this.view = view;
this.node = node;
}
static __NG_ELEMENT_ID__ = injectViewContext;
}
function injectViewContext() {
return new ViewContext(getLView(), getCurrentTNode());
}
class ChangeDetectionScheduler {}
const ZONELESS_ENABLED = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Zoneless enabled' : '', {
factory: () => true
});
const PROVIDED_ZONELESS = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Zoneless provided' : '', {
factory: () => false
});
const SCHEDULE_IN_ROOT_ZONE = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'run changes outside zone in root' : '');
class EffectScheduler {
static ɵprov =
/* @__PURE__ */
ɵɵdefineInjectable({
token: EffectScheduler,
providedIn: 'root',
factory: () => new ZoneAwareEffectScheduler()
});
}
class ZoneAwareEffectScheduler {
dirtyEffectCount = 0;
queues = new Map();
add(handle) {
this.enqueue(handle);
this.schedule(handle);
}
schedule(handle) {
if (!handle.dirty) {
return;
}
this.dirtyEffectCount++;
}
remove(handle) {
const zone = handle.zone;
const queue = this.queues.get(zone);
if (!queue.has(handle)) {
return;
}
queue.delete(handle);
if (handle.dirty) {
this.dirtyEffectCount--;
}
}
enqueue(handle) {
const zone = handle.zone;
if (!this.queues.has(zone)) {
this.queues.set(zone, new Set());
}
const queue = this.queues.get(zone);
if (queue.has(handle)) {
return;
}
queue.add(handle);
}
flush() {
while (this.dirtyEffectCount > 0) {
let ranOneEffect = false;
for (const [zone, queue] of this.queues) {
if (zone === null) {
ranOneEffect ||= this.flushQueue(queue);
} else {
ranOneEffect ||= zone.run(() => this.flushQueue(queue));
}
}
if (!ranOneEffect) {
this.dirtyEffectCount = 0;
}
}
}
flushQueue(queue) {
let ranOneEffect = false;
for (const handle of queue) {
if (!handle.dirty) {
continue;
}
this.dirtyEffectCount--;
ranOneEffect = true;
handle.run();
}
return ranOneEffect;
}
}
class EffectRefImpl {
[SIGNAL];
constructor(node) {
this[SIGNAL] = node;
}
destroy() {
this[SIGNAL].destroy();
}
}
function effect(effectFn, options) {
ngDevMode && assertNotInReactiveContext(effect, 'Call `effect` outside of a reactive context. For example, schedule the ' + 'effect inside the component constructor.');
if (ngDevMode && !options?.injector) {
assertInInjectionContext(effect);
}
if (ngDevMode && options?.allowSignalWrites !== undefined) {
console.warn(`The 'allowSignalWrites' flag is deprecated and no longer impacts effect() (writes are always allowed)`);
}
const injector = options?.injector ?? inject(Injector);
let destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
let node;
const viewContext = injector.get(ViewContext, null, {
optional: true
});
const notifier = injector.get(ChangeDetectionScheduler);
if (viewContext !== null) {
node = createViewEffect(viewContext.view, notifier, effectFn);
if (destroyRef instanceof NodeInjectorDestroyRef && destroyRef._lView === viewContext.view) {
destroyRef = null;
}
} else {
node = createRootEffect(effectFn, injector.get(EffectScheduler), notifier);
}
node.injector = injector;
if (destroyRef !== null) {
node.onDestroyFns = [destroyRef.onDestroy(() => node.destroy())];
}
const effectRef = new EffectRefImpl(node);
if (ngDevMode) {
node.debugName = options?.debugName ?? '';
const prevInjectorProfilerContext = setInjectorProfilerContext({
injector,
token: null
});
try {
emitEffectCreatedEvent(effectRef);
} finally {
setInjectorProfilerContext(prevInjectorProfilerContext);
}
}
return effectRef;
}
const EFFECT_NODE = /* @__PURE__ */(() => ({
...BASE_EFFECT_NODE,
cleanupFns: undefined,
zone: null,
onDestroyFns: null,
run() {
if (ngDevMode && isInNotificationPhase()) {
throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
}
const prevRefreshingViews = setIsRefreshingViews(false);
try {
runEffect(this);
} finally {
setIsRefreshingViews(prevRefreshingViews);
}
},
cleanup() {
if (!this.cleanupFns?.length) {
return;
}
const prevConsumer = setActiveConsumer$1(null);
try {
while (this.cleanupFns.length) {
this.cleanupFns.pop()();
}
} finally {
this.cleanupFns = [];
setActiveConsumer$1(prevConsumer);
}
}
}))();
const ROOT_EFFECT_NODE = /* @__PURE__ */(() => ({
...EFFECT_NODE,
consumerMarkedDirty() {
this.scheduler.schedule(this);
this.notifier.notify(12);
},
destroy() {
consumerDestroy(this);
if (this.onDestroyFns !== null) {
for (const fn of this.onDestroyFns) {
fn();
}
}
this.cleanup();
this.scheduler.remove(this);
}
}))();
const VIEW_EFFECT_NODE = /* @__PURE__ */(() => ({
...EFFECT_NODE,
consumerMarkedDirty() {
this.view[FLAGS] |= 8192;
markAncestorsForTraversal(this.view);
this.notifier.notify(13);
},
destroy() {
consumerDestroy(this);
if (this.onDestroyFns !== null) {
for (const fn of this.onDestroyFns) {
fn();
}
}
this.cleanup();
this.view[EFFECTS]?.delete(this);
}
}))();
function createViewEffect(view, notifier, fn) {
const node = Object.create(VIEW_EFFECT_NODE);
node.view = view;
node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
node.notifier = notifier;
node.fn = createEffectFn(node, fn);
view[EFFECTS] ??= new Set();
view[EFFECTS].add(node);
node.consumerMarkedDirty(node);
return node;
}
function createRootEffect(fn, scheduler, notifier) {
const node = Object.create(ROOT_EFFECT_NODE);
node.fn = createEffectFn(node, fn);
node.scheduler = scheduler;
node.notifier = notifier;
node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
node.scheduler.add(node);
node.notifier.notify(12);
return node;
}
function createEffectFn(node, fn) {
return () => {
fn(cleanupFn => (node.cleanupFns ??= []).push(cleanupFn));
};
}
function isSignal(value) {
return typeof value === 'function' && value[SIGNAL] !== undefined;
}
function isWritableSignal(value) {
return isSignal(value) && typeof value.set === 'function';
}
class PendingTasks {
internalPendingTasks = inject(PendingTasksInternal);
scheduler = inject(ChangeDetectionScheduler);
errorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
add() {
const taskId = this.internalPendingTasks.add();
return () => {
if (!this.internalPendingTasks.has(taskId)) {
return;
}
this.scheduler.notify(11);
this.internalPendingTasks.remove(taskId);
};
}
run(fn) {
const removeTask = this.add();
try {
fn().catch(this.errorHandler).finally(removeTask);
} catch (err) {
this.errorHandler(err);
removeTask();
}
}
static ɵprov =
/* @__PURE__ */
ɵɵdefineInjectable({
token: PendingTasks,
providedIn: 'root',
factory: () => new PendingTasks()
});
}
export { AFTER_RENDER_SEQUENCES_TO_ADD, ANIMATIONS, ANIMATION_MODULE_TYPE, APP_ID, CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTAINER_HEADER_OFFSET, CONTEXT, CSP_NONCE, ChangeDetectionScheduler, CheckNoChangesMode, DEBUG_TASK_TRACKER, DECLARATION_COMPONENT_VIEW, DECLARATION_LCONTAINER, DECLARATION_VIEW, DEHYDRATED_VIEWS, DOCUMENT, DOC_PAGE_BASE_URL, DestroyRef, EFFECTS, EFFECTS_TO_SCHEDULE, EMBEDDED_VIEW_INJECTOR, EMPTY_ARRAY, EMPTY_OBJ, ENVIRONMENT, ENVIRONMENT_INITIALIZER, ERROR_DETAILS_PAGE_BASE_URL, EffectRefImpl, EffectScheduler, EnvironmentInjector, ErrorHandler, EventEmitter, FLAGS, HEADER_OFFSET, HOST, HYDRATION, ID, IMAGE_CONFIG, IMAGE_CONFIG_DEFAULTS, INJECTOR, INJECTOR$1, INJECTOR_DEF_TYPES, INJECTOR_SCOPE, INTERNAL_APPLICATION_ERROR_HANDLER, InjectionToken, Injector, MATH_ML_NAMESPACE, MOVED_VIEWS, NATIVE, NEXT, NG_COMP_DEF, NG_DIR_DEF, NG_ELEMENT_ID, NG_FACTORY_DEF, NG_INJ_DEF, NG_MOD_DEF, NG_PIPE_DEF, NG_PROV_DEF, NgZone, NoopNgZone, NullInjector, ON_DESTROY_HOOKS, PARENT, PLATFORM_ID, PLATFORM_INITIALIZER, PREORDER_HOOK_FLAGS, PROVIDED_ZONELESS, PendingTasks, PendingTasksInternal, QUERIES, R3Injector, REACTIVE_TEMPLATE_CONSUMER, RENDERER, RuntimeError, SCHEDULE_IN_ROOT_ZONE, SCHEDULE_IN_ROOT_ZONE_DEFAULT, SVG_NAMESPACE, SecurityContext, TVIEW, T_HOST, TransferState, VERSION, VIEW_REFS, Version, ViewContext, XSS_SECURITY_URL, ZONELESS_ENABLED, _global, addToArray, angularZoneInstanceIdProperty, arrayEquals, arrayInsert2, arraySplice, assertDefined, assertDirectiveDef, assertDomNode, assertElement, assertEqual, assertFirstCreatePass, assertFirstUpdatePass, assertFunction, assertGreaterThan, assertGreaterThanOrEqual, assertHasParent, assertInInjectionContext, assertIndexInDeclRange, assertIndexInExpandoRange, assertIndexInRange, assertInjectImplementationNotEqual, assertLContainer, assertLView, assertLessThan, assertNgModuleType, assertNodeInjector, assertNotDefined, assertNotEqual, assertNotInReactiveContext, assertNotReactive, assertNotSame, assertNumber, assertNumberInRange, assertOneOf, assertParentView, assertProjectionSlots, assertSame, assertString, assertTIcu, assertTNode, assertTNodeCreationIndex, assertTNodeForLView, assertTNodeForTView, attachInjectFlag, checkSecurityContext, concatStringsWithSpace, convertToBitFlags, createInjector, createInjectorWithoutInjectorInstances, cyclicDependencyError, cyclicDependencyErrorWithDetails, debugStringifyTypeForError, decreaseElementDepthCount, deepForEach, effect, emitAfterRenderEffectPhaseCreatedEvent, emitInjectEvent, emitInjectorToCreateInstanceEvent, emitInstanceCreatedByInjectorEvent, emitProviderConfiguredEvent, enterDI, enterSkipHydrationBlock, enterView, errorHandlerEnvironmentInitializer, fillProperties, flatten, formatRuntimeError, forwardRef, getAllSpecialProviders, getBindingIndex, getBindingRoot, getBindingsEnabled, getClosureSafeProperty, getComponentDef, getComponentLViewByIndex, getConstant, getContextLView, getCurrentDirectiveDef, getCurrentDirectiveIndex, getCurrentParentTNode, getCurrentQueryIndex, getCurrentTNode, getCurrentTNodePlaceholderOk, getDirectiveDef, getDirectiveDefOrThrow, getElementDepthCount, getFactoryDef, getInjectableDef, getInjectorDef, getLView, getLViewParent, getNamespace, getNativeByIndex, getNativeByTNode, getNativeByTNodeOrNull, getNgModuleDef, getNgModuleDefOrThrow, getNullInjector, getOrCreateLViewCleanup, getOrCreateTViewCleanup, getPipeDef, getSelectedIndex, getSelectedTNode, getTNode, getTView, hasI18n, importProvidersFrom, increaseElementDepthCount, incrementBindingIndex, initNgDevMode, inject, injectRootLimpMode, internalImportProvidersFrom, isClassProvider, isComponentDef, isComponentHost, isContentQueryHost, isCreationMode, isCurrentTNodeParent, isDestroyed, isDirectiveHost, isEnvironmentProviders, isExhaustiveCheckNoChanges, isForwardRef, isInCheckNoChangesMode, isInI18nBlock, isInInjectionContext, isInSkipHydrationBlock, isInjectable, isLContainer, isLView, isProjectionTNode, isRefreshingViews, isRootView, isSignal, isSkipHydrationRootTNode, isStandalone, isTypeProvider, isWritableSignal, keyValueArrayGet, keyValueArrayIndexOf, keyValueArraySet, lastNodeWasCreated, leaveDI, leaveSkipHydrationBlock, leaveView, load, makeEnvironmentProviders, makeStateKey, markAncestorsForTraversal, markViewForRefresh, newArray, nextBindingIndex, nextContextImpl, promiseWithResolvers, provideBrowserGlobalErrorListeners, provideEnvironmentInitializer, providerToFactory, registerSpecialProvider, removeFromArray, removeLViewOnDestroy, renderStringify, requiresRefreshOrTraversal, resetPreOrderHookFlags, resolveForwardRef, retrieveTransferredState, runInInjectionContext, runInInjectorProfilerContext, scheduleCallbackWithMicrotask, scheduleCallbackWithRafRace, setBindingIndex, setBindingRootForHostBindings, setCurrentDirectiveIndex, setCurrentQueryIndex, setCurrentTNode, setCurrentTNodeAsNotParent, setInI18nBlock, setInjectImplementation, setInjectorProfiler, setInjectorProfilerContext, setIsInCheckNoChangesMode, setIsRefreshingViews, setSelectedIndex, signal, signalAsReadonlyFn, store, storeCleanupWithContext, storeLViewOnDestroy, stringify, stringifyForError, throwError, throwProviderNotFoundError, truncateMiddle, unwrapLView, unwrapRNode, updateAncestorTraversalFlagsOnAttach, validAppIdInitializer, viewAttachedToChangeDetector, viewAttachedToContainer, walkProviderTree, walkUpViews, wasLastNodeCreated, ɵunwrapWritableSignal, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdisableBindings, ɵɵenableBindings, ɵɵinject, ɵɵinvalidFactoryDep, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵresetView, ɵɵrestoreView };
//# sourceMappingURL=_pending_tasks-chunk.mjs.map