4126 lines
130 KiB
JavaScript
4126 lines
130 KiB
JavaScript
import {
|
|
CommonModule,
|
|
DomAdapter,
|
|
PLATFORM_BROWSER_ID,
|
|
PlatformLocation,
|
|
XhrFactory,
|
|
getDOM,
|
|
parseCookieValue,
|
|
setRootDomAdapter
|
|
} from "./chunk-OSQUZMO7.js";
|
|
import {
|
|
APP_BOOTSTRAP_LISTENER,
|
|
APP_ID,
|
|
ApplicationModule,
|
|
ApplicationRef,
|
|
CSP_NONCE,
|
|
Console,
|
|
IS_ENABLED_BLOCKING_INITIAL_NAVIGATION,
|
|
Inject,
|
|
Injectable,
|
|
NgModule,
|
|
Optional,
|
|
PLATFORM_ID,
|
|
PLATFORM_INITIALIZER,
|
|
RendererFactory2,
|
|
RendererStyleFlags2,
|
|
SecurityContext,
|
|
TESTABILITY,
|
|
TESTABILITY_GETTER,
|
|
Testability,
|
|
TracingService,
|
|
TransferState,
|
|
ViewEncapsulation,
|
|
_sanitizeHtml,
|
|
_sanitizeUrl,
|
|
allLeavingAnimations,
|
|
allowSanitizationBypassAndThrow,
|
|
bypassSanitizationTrustHtml,
|
|
bypassSanitizationTrustResourceUrl,
|
|
bypassSanitizationTrustScript,
|
|
bypassSanitizationTrustStyle,
|
|
bypassSanitizationTrustUrl,
|
|
createPlatformFactory,
|
|
internalCreateApplication,
|
|
makeStateKey,
|
|
performanceMarkFeature,
|
|
platformCore,
|
|
provideStabilityDebugging,
|
|
setClassMetadata,
|
|
setDocument,
|
|
unwrapSafeValue,
|
|
withDomHydration,
|
|
withEventReplay,
|
|
withI18nSupport,
|
|
withIncrementalHydration,
|
|
ɵɵdefineNgModule
|
|
} from "./chunk-QOTEZZCO.js";
|
|
import {
|
|
DOCUMENT,
|
|
DestroyRef,
|
|
ENVIRONMENT_INITIALIZER,
|
|
EnvironmentInjector,
|
|
ErrorHandler,
|
|
INJECTOR_SCOPE,
|
|
InjectionToken,
|
|
Injector,
|
|
NgZone,
|
|
Observable,
|
|
PendingTasks,
|
|
ResourceImpl,
|
|
RuntimeError,
|
|
Version,
|
|
XSS_SECURITY_URL,
|
|
__objRest,
|
|
__spreadProps,
|
|
__spreadValues,
|
|
_global,
|
|
assertInInjectionContext,
|
|
computed,
|
|
concatMap,
|
|
encapsulateResourceError,
|
|
filter,
|
|
finalize,
|
|
formatRuntimeError,
|
|
forwardRef,
|
|
inject,
|
|
linkedSignal,
|
|
makeEnvironmentProviders,
|
|
map,
|
|
of,
|
|
runInInjectionContext,
|
|
signal,
|
|
switchMap,
|
|
truncateMiddle,
|
|
ɵɵdefineInjectable,
|
|
ɵɵdefineInjector,
|
|
ɵɵinject
|
|
} from "./chunk-E5HF4UWX.js";
|
|
|
|
// node_modules/@angular/platform-browser/fesm2022/_dom_renderer-chunk.mjs
|
|
var EventManagerPlugin = class {
|
|
_doc;
|
|
constructor(_doc) {
|
|
this._doc = _doc;
|
|
}
|
|
manager;
|
|
};
|
|
var DomEventsPlugin = class _DomEventsPlugin extends EventManagerPlugin {
|
|
constructor(doc) {
|
|
super(doc);
|
|
}
|
|
supports(eventName) {
|
|
return true;
|
|
}
|
|
addEventListener(element, eventName, handler, options) {
|
|
element.addEventListener(eventName, handler, options);
|
|
return () => this.removeEventListener(element, eventName, handler, options);
|
|
}
|
|
removeEventListener(target, eventName, callback, options) {
|
|
return target.removeEventListener(eventName, callback, options);
|
|
}
|
|
static ɵfac = function DomEventsPlugin_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _DomEventsPlugin)(ɵɵinject(DOCUMENT));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _DomEventsPlugin,
|
|
factory: _DomEventsPlugin.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomEventsPlugin, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}], null);
|
|
})();
|
|
var EVENT_MANAGER_PLUGINS = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "EventManagerPlugins" : "");
|
|
var EventManager = class _EventManager {
|
|
_zone;
|
|
_plugins;
|
|
_eventNameToPlugin = /* @__PURE__ */ new Map();
|
|
constructor(plugins, _zone) {
|
|
this._zone = _zone;
|
|
plugins.forEach((plugin) => {
|
|
plugin.manager = this;
|
|
});
|
|
const otherPlugins = plugins.filter((p) => !(p instanceof DomEventsPlugin));
|
|
this._plugins = otherPlugins.slice().reverse();
|
|
const domEventPlugin = plugins.find((p) => p instanceof DomEventsPlugin);
|
|
if (domEventPlugin) {
|
|
this._plugins.push(domEventPlugin);
|
|
}
|
|
}
|
|
addEventListener(element, eventName, handler, options) {
|
|
const plugin = this._findPluginFor(eventName);
|
|
return plugin.addEventListener(element, eventName, handler, options);
|
|
}
|
|
getZone() {
|
|
return this._zone;
|
|
}
|
|
_findPluginFor(eventName) {
|
|
let plugin = this._eventNameToPlugin.get(eventName);
|
|
if (plugin) {
|
|
return plugin;
|
|
}
|
|
const plugins = this._plugins;
|
|
plugin = plugins.find((plugin2) => plugin2.supports(eventName));
|
|
if (!plugin) {
|
|
throw new RuntimeError(5101, (typeof ngDevMode === "undefined" || ngDevMode) && `No event manager plugin found for event ${eventName}`);
|
|
}
|
|
this._eventNameToPlugin.set(eventName, plugin);
|
|
return plugin;
|
|
}
|
|
static ɵfac = function EventManager_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _EventManager)(ɵɵinject(EVENT_MANAGER_PLUGINS), ɵɵinject(NgZone));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _EventManager,
|
|
factory: _EventManager.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(EventManager, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [EVENT_MANAGER_PLUGINS]
|
|
}]
|
|
}, {
|
|
type: NgZone
|
|
}], null);
|
|
})();
|
|
var APP_ID_ATTRIBUTE_NAME = "ng-app-id";
|
|
function removeElements(elements) {
|
|
for (const element of elements) {
|
|
element.remove();
|
|
}
|
|
}
|
|
function createStyleElement(style, doc) {
|
|
const styleElement = doc.createElement("style");
|
|
styleElement.textContent = style;
|
|
return styleElement;
|
|
}
|
|
function addServerStyles(doc, appId, inline, external) {
|
|
const elements = doc.head?.querySelectorAll(`style[${APP_ID_ATTRIBUTE_NAME}="${appId}"],link[${APP_ID_ATTRIBUTE_NAME}="${appId}"]`);
|
|
if (elements) {
|
|
for (const styleElement of elements) {
|
|
styleElement.removeAttribute(APP_ID_ATTRIBUTE_NAME);
|
|
if (styleElement instanceof HTMLLinkElement) {
|
|
external.set(styleElement.href.slice(styleElement.href.lastIndexOf("/") + 1), {
|
|
usage: 0,
|
|
elements: [styleElement]
|
|
});
|
|
} else if (styleElement.textContent) {
|
|
inline.set(styleElement.textContent, {
|
|
usage: 0,
|
|
elements: [styleElement]
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function createLinkElement(url, doc) {
|
|
const linkElement = doc.createElement("link");
|
|
linkElement.setAttribute("rel", "stylesheet");
|
|
linkElement.setAttribute("href", url);
|
|
return linkElement;
|
|
}
|
|
var SharedStylesHost = class _SharedStylesHost {
|
|
doc;
|
|
appId;
|
|
nonce;
|
|
inline = /* @__PURE__ */ new Map();
|
|
external = /* @__PURE__ */ new Map();
|
|
hosts = /* @__PURE__ */ new Set();
|
|
constructor(doc, appId, nonce, platformId = {}) {
|
|
this.doc = doc;
|
|
this.appId = appId;
|
|
this.nonce = nonce;
|
|
addServerStyles(doc, appId, this.inline, this.external);
|
|
this.hosts.add(doc.head);
|
|
}
|
|
addStyles(styles, urls) {
|
|
for (const value of styles) {
|
|
this.addUsage(value, this.inline, createStyleElement);
|
|
}
|
|
urls?.forEach((value) => this.addUsage(value, this.external, createLinkElement));
|
|
}
|
|
removeStyles(styles, urls) {
|
|
for (const value of styles) {
|
|
this.removeUsage(value, this.inline);
|
|
}
|
|
urls?.forEach((value) => this.removeUsage(value, this.external));
|
|
}
|
|
addUsage(value, usages, creator) {
|
|
const record = usages.get(value);
|
|
if (record) {
|
|
if ((typeof ngDevMode === "undefined" || ngDevMode) && record.usage === 0) {
|
|
record.elements.forEach((element) => element.setAttribute("ng-style-reused", ""));
|
|
}
|
|
record.usage++;
|
|
} else {
|
|
usages.set(value, {
|
|
usage: 1,
|
|
elements: [...this.hosts].map((host) => this.addElement(host, creator(value, this.doc)))
|
|
});
|
|
}
|
|
}
|
|
removeUsage(value, usages) {
|
|
const record = usages.get(value);
|
|
if (record) {
|
|
record.usage--;
|
|
if (record.usage <= 0) {
|
|
removeElements(record.elements);
|
|
usages.delete(value);
|
|
}
|
|
}
|
|
}
|
|
ngOnDestroy() {
|
|
for (const [, {
|
|
elements
|
|
}] of [...this.inline, ...this.external]) {
|
|
removeElements(elements);
|
|
}
|
|
this.hosts.clear();
|
|
}
|
|
addHost(hostNode) {
|
|
this.hosts.add(hostNode);
|
|
for (const [style, {
|
|
elements
|
|
}] of this.inline) {
|
|
elements.push(this.addElement(hostNode, createStyleElement(style, this.doc)));
|
|
}
|
|
for (const [url, {
|
|
elements
|
|
}] of this.external) {
|
|
elements.push(this.addElement(hostNode, createLinkElement(url, this.doc)));
|
|
}
|
|
}
|
|
removeHost(hostNode) {
|
|
this.hosts.delete(hostNode);
|
|
}
|
|
addElement(host, element) {
|
|
if (this.nonce) {
|
|
element.setAttribute("nonce", this.nonce);
|
|
}
|
|
if (false) {
|
|
element.setAttribute(APP_ID_ATTRIBUTE_NAME, this.appId);
|
|
}
|
|
return host.appendChild(element);
|
|
}
|
|
static ɵfac = function SharedStylesHost_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _SharedStylesHost)(ɵɵinject(DOCUMENT), ɵɵinject(APP_ID), ɵɵinject(CSP_NONCE, 8), ɵɵinject(PLATFORM_ID));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _SharedStylesHost,
|
|
factory: _SharedStylesHost.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SharedStylesHost, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: Document,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [APP_ID]
|
|
}]
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [CSP_NONCE]
|
|
}, {
|
|
type: Optional
|
|
}]
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [PLATFORM_ID]
|
|
}]
|
|
}], null);
|
|
})();
|
|
var NAMESPACE_URIS = {
|
|
"svg": "http://www.w3.org/2000/svg",
|
|
"xhtml": "http://www.w3.org/1999/xhtml",
|
|
"xlink": "http://www.w3.org/1999/xlink",
|
|
"xml": "http://www.w3.org/XML/1998/namespace",
|
|
"xmlns": "http://www.w3.org/2000/xmlns/",
|
|
"math": "http://www.w3.org/1998/Math/MathML"
|
|
};
|
|
var COMPONENT_REGEX = /%COMP%/g;
|
|
var SOURCEMAP_URL_REGEXP = /\/\*#\s*sourceMappingURL=(.+?)\s*\*\//;
|
|
var PROTOCOL_REGEXP = /^https?:/;
|
|
var COMPONENT_VARIABLE = "%COMP%";
|
|
var HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
|
|
var CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
|
|
var REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = true;
|
|
var REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "RemoveStylesOnCompDestroy" : "", {
|
|
factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT
|
|
});
|
|
function shimContentAttribute(componentShortId) {
|
|
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
|
}
|
|
function shimHostAttribute(componentShortId) {
|
|
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
|
}
|
|
function shimStylesContent(compId, styles) {
|
|
return styles.map((s) => s.replace(COMPONENT_REGEX, compId));
|
|
}
|
|
function addBaseHrefToCssSourceMap(baseHref, styles) {
|
|
if (!baseHref) {
|
|
return styles;
|
|
}
|
|
const absoluteBaseHrefUrl = new URL(baseHref, "http://localhost");
|
|
return styles.map((cssContent) => {
|
|
if (!cssContent.includes("sourceMappingURL=")) {
|
|
return cssContent;
|
|
}
|
|
return cssContent.replace(SOURCEMAP_URL_REGEXP, (_, sourceMapUrl) => {
|
|
if (sourceMapUrl[0] === "/" || sourceMapUrl.startsWith("data:") || PROTOCOL_REGEXP.test(sourceMapUrl)) {
|
|
return `/*# sourceMappingURL=${sourceMapUrl} */`;
|
|
}
|
|
const {
|
|
pathname: resolvedSourceMapUrl
|
|
} = new URL(sourceMapUrl, absoluteBaseHrefUrl);
|
|
return `/*# sourceMappingURL=${resolvedSourceMapUrl} */`;
|
|
});
|
|
});
|
|
}
|
|
var DomRendererFactory2 = class _DomRendererFactory2 {
|
|
eventManager;
|
|
sharedStylesHost;
|
|
appId;
|
|
removeStylesOnCompDestroy;
|
|
doc;
|
|
ngZone;
|
|
nonce;
|
|
tracingService;
|
|
rendererByCompId = /* @__PURE__ */ new Map();
|
|
defaultRenderer;
|
|
constructor(eventManager, sharedStylesHost, appId, removeStylesOnCompDestroy, doc, ngZone, nonce = null, tracingService = null) {
|
|
this.eventManager = eventManager;
|
|
this.sharedStylesHost = sharedStylesHost;
|
|
this.appId = appId;
|
|
this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
|
|
this.doc = doc;
|
|
this.ngZone = ngZone;
|
|
this.nonce = nonce;
|
|
this.tracingService = tracingService;
|
|
this.defaultRenderer = new DefaultDomRenderer2(eventManager, doc, ngZone, this.tracingService);
|
|
}
|
|
createRenderer(element, type) {
|
|
if (!element || !type) {
|
|
return this.defaultRenderer;
|
|
}
|
|
if (false) {
|
|
type = __spreadProps(__spreadValues({}, type), {
|
|
encapsulation: ViewEncapsulation.Emulated
|
|
});
|
|
}
|
|
const renderer = this.getOrCreateRenderer(element, type);
|
|
if (renderer instanceof EmulatedEncapsulationDomRenderer2) {
|
|
renderer.applyToHost(element);
|
|
} else if (renderer instanceof NoneEncapsulationDomRenderer) {
|
|
renderer.applyStyles();
|
|
}
|
|
return renderer;
|
|
}
|
|
getOrCreateRenderer(element, type) {
|
|
const rendererByCompId = this.rendererByCompId;
|
|
let renderer = rendererByCompId.get(type.id);
|
|
if (!renderer) {
|
|
const doc = this.doc;
|
|
const ngZone = this.ngZone;
|
|
const eventManager = this.eventManager;
|
|
const sharedStylesHost = this.sharedStylesHost;
|
|
const removeStylesOnCompDestroy = this.removeStylesOnCompDestroy;
|
|
const tracingService = this.tracingService;
|
|
switch (type.encapsulation) {
|
|
case ViewEncapsulation.Emulated:
|
|
renderer = new EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, type, this.appId, removeStylesOnCompDestroy, doc, ngZone, tracingService);
|
|
break;
|
|
case ViewEncapsulation.ShadowDom:
|
|
return new ShadowDomRenderer(eventManager, element, type, doc, ngZone, this.nonce, tracingService, sharedStylesHost);
|
|
case ViewEncapsulation.ExperimentalIsolatedShadowDom:
|
|
return new ShadowDomRenderer(eventManager, element, type, doc, ngZone, this.nonce, tracingService);
|
|
default:
|
|
renderer = new NoneEncapsulationDomRenderer(eventManager, sharedStylesHost, type, removeStylesOnCompDestroy, doc, ngZone, tracingService);
|
|
break;
|
|
}
|
|
rendererByCompId.set(type.id, renderer);
|
|
}
|
|
return renderer;
|
|
}
|
|
ngOnDestroy() {
|
|
this.rendererByCompId.clear();
|
|
}
|
|
componentReplaced(componentId) {
|
|
this.rendererByCompId.delete(componentId);
|
|
}
|
|
static ɵfac = function DomRendererFactory2_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _DomRendererFactory2)(ɵɵinject(EventManager), ɵɵinject(SharedStylesHost), ɵɵinject(APP_ID), ɵɵinject(REMOVE_STYLES_ON_COMPONENT_DESTROY), ɵɵinject(DOCUMENT), ɵɵinject(NgZone), ɵɵinject(CSP_NONCE), ɵɵinject(TracingService, 8));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _DomRendererFactory2,
|
|
factory: _DomRendererFactory2.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomRendererFactory2, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: EventManager
|
|
}, {
|
|
type: SharedStylesHost
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [APP_ID]
|
|
}]
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [REMOVE_STYLES_ON_COMPONENT_DESTROY]
|
|
}]
|
|
}, {
|
|
type: Document,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}, {
|
|
type: NgZone
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [CSP_NONCE]
|
|
}]
|
|
}, {
|
|
type: TracingService,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [TracingService]
|
|
}, {
|
|
type: Optional
|
|
}]
|
|
}], null);
|
|
})();
|
|
var DefaultDomRenderer2 = class {
|
|
eventManager;
|
|
doc;
|
|
ngZone;
|
|
tracingService;
|
|
data = /* @__PURE__ */ Object.create(null);
|
|
throwOnSyntheticProps = true;
|
|
constructor(eventManager, doc, ngZone, tracingService) {
|
|
this.eventManager = eventManager;
|
|
this.doc = doc;
|
|
this.ngZone = ngZone;
|
|
this.tracingService = tracingService;
|
|
}
|
|
destroy() {
|
|
}
|
|
destroyNode = null;
|
|
createElement(name, namespace) {
|
|
if (namespace) {
|
|
return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
|
|
}
|
|
return this.doc.createElement(name);
|
|
}
|
|
createComment(value) {
|
|
return this.doc.createComment(value);
|
|
}
|
|
createText(value) {
|
|
return this.doc.createTextNode(value);
|
|
}
|
|
appendChild(parent, newChild) {
|
|
const targetParent = isTemplateNode(parent) ? parent.content : parent;
|
|
targetParent.appendChild(newChild);
|
|
}
|
|
insertBefore(parent, newChild, refChild) {
|
|
if (parent) {
|
|
const targetParent = isTemplateNode(parent) ? parent.content : parent;
|
|
targetParent.insertBefore(newChild, refChild);
|
|
}
|
|
}
|
|
removeChild(_parent, oldChild) {
|
|
oldChild.remove();
|
|
}
|
|
selectRootElement(selectorOrNode, preserveContent) {
|
|
let el = typeof selectorOrNode === "string" ? this.doc.querySelector(selectorOrNode) : selectorOrNode;
|
|
if (!el) {
|
|
throw new RuntimeError(-5104, (typeof ngDevMode === "undefined" || ngDevMode) && `The selector "${selectorOrNode}" did not match any elements`);
|
|
}
|
|
if (!preserveContent) {
|
|
el.textContent = "";
|
|
}
|
|
return el;
|
|
}
|
|
parentNode(node) {
|
|
return node.parentNode;
|
|
}
|
|
nextSibling(node) {
|
|
return node.nextSibling;
|
|
}
|
|
setAttribute(el, name, value, namespace) {
|
|
if (namespace) {
|
|
name = namespace + ":" + name;
|
|
const namespaceUri = NAMESPACE_URIS[namespace];
|
|
if (namespaceUri) {
|
|
el.setAttributeNS(namespaceUri, name, value);
|
|
} else {
|
|
el.setAttribute(name, value);
|
|
}
|
|
} else {
|
|
el.setAttribute(name, value);
|
|
}
|
|
}
|
|
removeAttribute(el, name, namespace) {
|
|
if (namespace) {
|
|
const namespaceUri = NAMESPACE_URIS[namespace];
|
|
if (namespaceUri) {
|
|
el.removeAttributeNS(namespaceUri, name);
|
|
} else {
|
|
el.removeAttribute(`${namespace}:${name}`);
|
|
}
|
|
} else {
|
|
el.removeAttribute(name);
|
|
}
|
|
}
|
|
addClass(el, name) {
|
|
el.classList.add(name);
|
|
}
|
|
removeClass(el, name) {
|
|
el.classList.remove(name);
|
|
}
|
|
setStyle(el, style, value, flags) {
|
|
if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {
|
|
el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? "important" : "");
|
|
} else {
|
|
el.style[style] = value;
|
|
}
|
|
}
|
|
removeStyle(el, style, flags) {
|
|
if (flags & RendererStyleFlags2.DashCase) {
|
|
el.style.removeProperty(style);
|
|
} else {
|
|
el.style[style] = "";
|
|
}
|
|
}
|
|
setProperty(el, name, value) {
|
|
if (el == null) {
|
|
return;
|
|
}
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(name, "property");
|
|
el[name] = value;
|
|
}
|
|
setValue(node, value) {
|
|
node.nodeValue = value;
|
|
}
|
|
listen(target, event, callback, options) {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(event, "listener");
|
|
if (typeof target === "string") {
|
|
target = getDOM().getGlobalEventTarget(this.doc, target);
|
|
if (!target) {
|
|
throw new RuntimeError(5102, (typeof ngDevMode === "undefined" || ngDevMode) && `Unsupported event target ${target} for event ${event}`);
|
|
}
|
|
}
|
|
let wrappedCallback = this.decoratePreventDefault(callback);
|
|
if (this.tracingService?.wrapEventListener) {
|
|
wrappedCallback = this.tracingService.wrapEventListener(target, event, wrappedCallback);
|
|
}
|
|
return this.eventManager.addEventListener(target, event, wrappedCallback, options);
|
|
}
|
|
decoratePreventDefault(eventHandler) {
|
|
return (event) => {
|
|
if (event === "__ngUnwrap__") {
|
|
return eventHandler;
|
|
}
|
|
const allowDefaultBehavior = false ? this.ngZone.runGuarded(() => eventHandler(event)) : eventHandler(event);
|
|
if (allowDefaultBehavior === false) {
|
|
event.preventDefault();
|
|
}
|
|
return void 0;
|
|
};
|
|
}
|
|
};
|
|
var AT_CHARCODE = (() => "@".charCodeAt(0))();
|
|
function checkNoSyntheticProp(name, nameKind) {
|
|
if (name.charCodeAt(0) === AT_CHARCODE) {
|
|
throw new RuntimeError(5105, `Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
|
|
- Make sure \`provideAnimationsAsync()\`, \`provideAnimations()\` or \`provideNoopAnimations()\` call was added to a list of providers used to bootstrap an application.
|
|
- There is a corresponding animation configuration named \`${name}\` defined in the \`animations\` field of the \`@Component\` decorator (see https://angular.dev/api/core/Component#animations).`);
|
|
}
|
|
}
|
|
function isTemplateNode(node) {
|
|
return node.tagName === "TEMPLATE" && node.content !== void 0;
|
|
}
|
|
var ShadowDomRenderer = class extends DefaultDomRenderer2 {
|
|
hostEl;
|
|
sharedStylesHost;
|
|
shadowRoot;
|
|
constructor(eventManager, hostEl, component, doc, ngZone, nonce, tracingService, sharedStylesHost) {
|
|
super(eventManager, doc, ngZone, tracingService);
|
|
this.hostEl = hostEl;
|
|
this.sharedStylesHost = sharedStylesHost;
|
|
this.shadowRoot = hostEl.attachShadow({
|
|
mode: "open"
|
|
});
|
|
if (this.sharedStylesHost) {
|
|
this.sharedStylesHost.addHost(this.shadowRoot);
|
|
}
|
|
let styles = component.styles;
|
|
if (ngDevMode) {
|
|
const baseHref = getDOM().getBaseHref(doc) ?? "";
|
|
styles = addBaseHrefToCssSourceMap(baseHref, styles);
|
|
}
|
|
styles = shimStylesContent(component.id, styles);
|
|
for (const style of styles) {
|
|
const styleEl = document.createElement("style");
|
|
if (nonce) {
|
|
styleEl.setAttribute("nonce", nonce);
|
|
}
|
|
styleEl.textContent = style;
|
|
this.shadowRoot.appendChild(styleEl);
|
|
}
|
|
const styleUrls = component.getExternalStyles?.();
|
|
if (styleUrls) {
|
|
for (const styleUrl of styleUrls) {
|
|
const linkEl = createLinkElement(styleUrl, doc);
|
|
if (nonce) {
|
|
linkEl.setAttribute("nonce", nonce);
|
|
}
|
|
this.shadowRoot.appendChild(linkEl);
|
|
}
|
|
}
|
|
}
|
|
nodeOrShadowRoot(node) {
|
|
return node === this.hostEl ? this.shadowRoot : node;
|
|
}
|
|
appendChild(parent, newChild) {
|
|
return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
|
|
}
|
|
insertBefore(parent, newChild, refChild) {
|
|
return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
|
|
}
|
|
removeChild(_parent, oldChild) {
|
|
return super.removeChild(null, oldChild);
|
|
}
|
|
parentNode(node) {
|
|
return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
|
|
}
|
|
destroy() {
|
|
if (this.sharedStylesHost) {
|
|
this.sharedStylesHost.removeHost(this.shadowRoot);
|
|
}
|
|
}
|
|
};
|
|
var NoneEncapsulationDomRenderer = class extends DefaultDomRenderer2 {
|
|
sharedStylesHost;
|
|
removeStylesOnCompDestroy;
|
|
styles;
|
|
styleUrls;
|
|
constructor(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, tracingService, compId) {
|
|
super(eventManager, doc, ngZone, tracingService);
|
|
this.sharedStylesHost = sharedStylesHost;
|
|
this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
|
|
let styles = component.styles;
|
|
if (ngDevMode) {
|
|
const baseHref = getDOM().getBaseHref(doc) ?? "";
|
|
styles = addBaseHrefToCssSourceMap(baseHref, styles);
|
|
}
|
|
this.styles = compId ? shimStylesContent(compId, styles) : styles;
|
|
this.styleUrls = component.getExternalStyles?.(compId);
|
|
}
|
|
applyStyles() {
|
|
this.sharedStylesHost.addStyles(this.styles, this.styleUrls);
|
|
}
|
|
destroy() {
|
|
if (!this.removeStylesOnCompDestroy) {
|
|
return;
|
|
}
|
|
if (allLeavingAnimations.size === 0) {
|
|
this.sharedStylesHost.removeStyles(this.styles, this.styleUrls);
|
|
}
|
|
}
|
|
};
|
|
var EmulatedEncapsulationDomRenderer2 = class extends NoneEncapsulationDomRenderer {
|
|
contentAttr;
|
|
hostAttr;
|
|
constructor(eventManager, sharedStylesHost, component, appId, removeStylesOnCompDestroy, doc, ngZone, tracingService) {
|
|
const compId = appId + "-" + component.id;
|
|
super(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, tracingService, compId);
|
|
this.contentAttr = shimContentAttribute(compId);
|
|
this.hostAttr = shimHostAttribute(compId);
|
|
}
|
|
applyToHost(element) {
|
|
this.applyStyles();
|
|
this.setAttribute(element, this.hostAttr, "");
|
|
}
|
|
createElement(parent, name) {
|
|
const el = super.createElement(parent, name);
|
|
super.setAttribute(el, this.contentAttr, "");
|
|
return el;
|
|
}
|
|
};
|
|
|
|
// node_modules/@angular/platform-browser/fesm2022/_browser-chunk.mjs
|
|
var BrowserDomAdapter = class _BrowserDomAdapter extends DomAdapter {
|
|
supportsDOMEvents = true;
|
|
static makeCurrent() {
|
|
setRootDomAdapter(new _BrowserDomAdapter());
|
|
}
|
|
onAndCancel(el, evt, listener, options) {
|
|
el.addEventListener(evt, listener, options);
|
|
return () => {
|
|
el.removeEventListener(evt, listener, options);
|
|
};
|
|
}
|
|
dispatchEvent(el, evt) {
|
|
el.dispatchEvent(evt);
|
|
}
|
|
remove(node) {
|
|
node.remove();
|
|
}
|
|
createElement(tagName, doc) {
|
|
doc = doc || this.getDefaultDocument();
|
|
return doc.createElement(tagName);
|
|
}
|
|
createHtmlDocument() {
|
|
return document.implementation.createHTMLDocument("fakeTitle");
|
|
}
|
|
getDefaultDocument() {
|
|
return document;
|
|
}
|
|
isElementNode(node) {
|
|
return node.nodeType === Node.ELEMENT_NODE;
|
|
}
|
|
isShadowRoot(node) {
|
|
return node instanceof DocumentFragment;
|
|
}
|
|
getGlobalEventTarget(doc, target) {
|
|
if (target === "window") {
|
|
return window;
|
|
}
|
|
if (target === "document") {
|
|
return doc;
|
|
}
|
|
if (target === "body") {
|
|
return doc.body;
|
|
}
|
|
return null;
|
|
}
|
|
getBaseHref(doc) {
|
|
const href = getBaseElementHref();
|
|
return href == null ? null : relativePath(href);
|
|
}
|
|
resetBaseElement() {
|
|
baseElement = null;
|
|
}
|
|
getUserAgent() {
|
|
return window.navigator.userAgent;
|
|
}
|
|
getCookie(name) {
|
|
return parseCookieValue(document.cookie, name);
|
|
}
|
|
};
|
|
var baseElement = null;
|
|
function getBaseElementHref() {
|
|
baseElement = baseElement || document.head.querySelector("base");
|
|
return baseElement ? baseElement.getAttribute("href") : null;
|
|
}
|
|
function relativePath(url) {
|
|
return new URL(url, document.baseURI).pathname;
|
|
}
|
|
var BrowserGetTestability = class {
|
|
addToWindow(registry) {
|
|
_global["getAngularTestability"] = (elem, findInAncestors = true) => {
|
|
const testability = registry.findTestabilityInTree(elem, findInAncestors);
|
|
if (testability == null) {
|
|
throw new RuntimeError(5103, (typeof ngDevMode === "undefined" || ngDevMode) && "Could not find testability for element.");
|
|
}
|
|
return testability;
|
|
};
|
|
_global["getAllAngularTestabilities"] = () => registry.getAllTestabilities();
|
|
_global["getAllAngularRootElements"] = () => registry.getAllRootElements();
|
|
const whenAllStable = (callback) => {
|
|
const testabilities = _global["getAllAngularTestabilities"]();
|
|
let count = testabilities.length;
|
|
const decrement = function() {
|
|
count--;
|
|
if (count == 0) {
|
|
callback();
|
|
}
|
|
};
|
|
testabilities.forEach((testability) => {
|
|
testability.whenStable(decrement);
|
|
});
|
|
};
|
|
if (!_global["frameworkStabilizers"]) {
|
|
_global["frameworkStabilizers"] = [];
|
|
}
|
|
_global["frameworkStabilizers"].push(whenAllStable);
|
|
}
|
|
findTestabilityInTree(registry, elem, findInAncestors) {
|
|
if (elem == null) {
|
|
return null;
|
|
}
|
|
const t = registry.getTestability(elem);
|
|
if (t != null) {
|
|
return t;
|
|
} else if (!findInAncestors) {
|
|
return null;
|
|
}
|
|
if (getDOM().isShadowRoot(elem)) {
|
|
return this.findTestabilityInTree(registry, elem.host, true);
|
|
}
|
|
return this.findTestabilityInTree(registry, elem.parentElement, true);
|
|
}
|
|
};
|
|
var BrowserXhr = class _BrowserXhr {
|
|
build() {
|
|
return new XMLHttpRequest();
|
|
}
|
|
static ɵfac = function BrowserXhr_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _BrowserXhr)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _BrowserXhr,
|
|
factory: _BrowserXhr.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserXhr, [{
|
|
type: Injectable
|
|
}], null, null);
|
|
})();
|
|
var MODIFIER_KEYS = ["alt", "control", "meta", "shift"];
|
|
var _keyMap = {
|
|
"\b": "Backspace",
|
|
" ": "Tab",
|
|
"": "Delete",
|
|
"\x1B": "Escape",
|
|
"Del": "Delete",
|
|
"Esc": "Escape",
|
|
"Left": "ArrowLeft",
|
|
"Right": "ArrowRight",
|
|
"Up": "ArrowUp",
|
|
"Down": "ArrowDown",
|
|
"Menu": "ContextMenu",
|
|
"Scroll": "ScrollLock",
|
|
"Win": "OS"
|
|
};
|
|
var MODIFIER_KEY_GETTERS = {
|
|
"alt": (event) => event.altKey,
|
|
"control": (event) => event.ctrlKey,
|
|
"meta": (event) => event.metaKey,
|
|
"shift": (event) => event.shiftKey
|
|
};
|
|
var KeyEventsPlugin = class _KeyEventsPlugin extends EventManagerPlugin {
|
|
constructor(doc) {
|
|
super(doc);
|
|
}
|
|
supports(eventName) {
|
|
return _KeyEventsPlugin.parseEventName(eventName) != null;
|
|
}
|
|
addEventListener(element, eventName, handler, options) {
|
|
const parsedEvent = _KeyEventsPlugin.parseEventName(eventName);
|
|
const outsideHandler = _KeyEventsPlugin.eventCallback(parsedEvent["fullKey"], handler, this.manager.getZone());
|
|
return this.manager.getZone().runOutsideAngular(() => {
|
|
return getDOM().onAndCancel(element, parsedEvent["domEventName"], outsideHandler, options);
|
|
});
|
|
}
|
|
static parseEventName(eventName) {
|
|
const parts = eventName.toLowerCase().split(".");
|
|
const domEventName = parts.shift();
|
|
if (parts.length === 0 || !(domEventName === "keydown" || domEventName === "keyup")) {
|
|
return null;
|
|
}
|
|
const key = _KeyEventsPlugin._normalizeKey(parts.pop());
|
|
let fullKey = "";
|
|
let codeIX = parts.indexOf("code");
|
|
if (codeIX > -1) {
|
|
parts.splice(codeIX, 1);
|
|
fullKey = "code.";
|
|
}
|
|
MODIFIER_KEYS.forEach((modifierName) => {
|
|
const index = parts.indexOf(modifierName);
|
|
if (index > -1) {
|
|
parts.splice(index, 1);
|
|
fullKey += modifierName + ".";
|
|
}
|
|
});
|
|
fullKey += key;
|
|
if (parts.length != 0 || key.length === 0) {
|
|
return null;
|
|
}
|
|
const result = {};
|
|
result["domEventName"] = domEventName;
|
|
result["fullKey"] = fullKey;
|
|
return result;
|
|
}
|
|
static matchEventFullKeyCode(event, fullKeyCode) {
|
|
let keycode = _keyMap[event.key] || event.key;
|
|
let key = "";
|
|
if (fullKeyCode.indexOf("code.") > -1) {
|
|
keycode = event.code;
|
|
key = "code.";
|
|
}
|
|
if (keycode == null || !keycode) return false;
|
|
keycode = keycode.toLowerCase();
|
|
if (keycode === " ") {
|
|
keycode = "space";
|
|
} else if (keycode === ".") {
|
|
keycode = "dot";
|
|
}
|
|
MODIFIER_KEYS.forEach((modifierName) => {
|
|
if (modifierName !== keycode) {
|
|
const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
|
if (modifierGetter(event)) {
|
|
key += modifierName + ".";
|
|
}
|
|
}
|
|
});
|
|
key += keycode;
|
|
return key === fullKeyCode;
|
|
}
|
|
static eventCallback(fullKey, handler, zone) {
|
|
return (event) => {
|
|
if (_KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {
|
|
zone.runGuarded(() => handler(event));
|
|
}
|
|
};
|
|
}
|
|
static _normalizeKey(keyName) {
|
|
return keyName === "esc" ? "escape" : keyName;
|
|
}
|
|
static ɵfac = function KeyEventsPlugin_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _KeyEventsPlugin)(ɵɵinject(DOCUMENT));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _KeyEventsPlugin,
|
|
factory: _KeyEventsPlugin.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(KeyEventsPlugin, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}], null);
|
|
})();
|
|
async function bootstrapApplication(rootComponent, options, context) {
|
|
const config = __spreadValues({
|
|
rootComponent
|
|
}, createProvidersConfig(options, context));
|
|
if (false) {
|
|
await resolveJitResources();
|
|
}
|
|
return internalCreateApplication(config);
|
|
}
|
|
async function createApplication(options, context) {
|
|
if (false) {
|
|
await resolveJitResources();
|
|
}
|
|
return internalCreateApplication(createProvidersConfig(options, context));
|
|
}
|
|
function createProvidersConfig(options, context) {
|
|
return {
|
|
platformRef: context?.platformRef,
|
|
appProviders: [...BROWSER_MODULE_PROVIDERS, ...options?.providers ?? []],
|
|
platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS
|
|
};
|
|
}
|
|
function provideProtractorTestingSupport() {
|
|
return [...TESTABILITY_PROVIDERS];
|
|
}
|
|
function initDomAdapter() {
|
|
BrowserDomAdapter.makeCurrent();
|
|
}
|
|
function errorHandler() {
|
|
return new ErrorHandler();
|
|
}
|
|
function _document() {
|
|
setDocument(document);
|
|
return document;
|
|
}
|
|
var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [{
|
|
provide: PLATFORM_ID,
|
|
useValue: PLATFORM_BROWSER_ID
|
|
}, {
|
|
provide: PLATFORM_INITIALIZER,
|
|
useValue: initDomAdapter,
|
|
multi: true
|
|
}, {
|
|
provide: DOCUMENT,
|
|
useFactory: _document
|
|
}];
|
|
var platformBrowser = createPlatformFactory(platformCore, "browser", INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
|
var BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "BrowserModule Providers Marker" : "");
|
|
var TESTABILITY_PROVIDERS = [{
|
|
provide: TESTABILITY_GETTER,
|
|
useClass: BrowserGetTestability
|
|
}, {
|
|
provide: TESTABILITY,
|
|
useClass: Testability
|
|
}, {
|
|
provide: Testability,
|
|
useClass: Testability
|
|
}];
|
|
var BROWSER_MODULE_PROVIDERS = [{
|
|
provide: INJECTOR_SCOPE,
|
|
useValue: "root"
|
|
}, {
|
|
provide: ErrorHandler,
|
|
useFactory: errorHandler
|
|
}, {
|
|
provide: EVENT_MANAGER_PLUGINS,
|
|
useClass: DomEventsPlugin,
|
|
multi: true
|
|
}, {
|
|
provide: EVENT_MANAGER_PLUGINS,
|
|
useClass: KeyEventsPlugin,
|
|
multi: true
|
|
}, DomRendererFactory2, SharedStylesHost, EventManager, {
|
|
provide: RendererFactory2,
|
|
useExisting: DomRendererFactory2
|
|
}, {
|
|
provide: XhrFactory,
|
|
useClass: BrowserXhr
|
|
}, typeof ngDevMode === "undefined" || ngDevMode ? {
|
|
provide: BROWSER_MODULE_PROVIDERS_MARKER,
|
|
useValue: true
|
|
} : []];
|
|
var BrowserModule = class _BrowserModule {
|
|
constructor() {
|
|
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
const providersAlreadyPresent = inject(BROWSER_MODULE_PROVIDERS_MARKER, {
|
|
optional: true,
|
|
skipSelf: true
|
|
});
|
|
if (providersAlreadyPresent) {
|
|
throw new RuntimeError(5100, `Providers from the \`BrowserModule\` have already been loaded. If you need access to common directives such as NgIf and NgFor, import the \`CommonModule\` instead.`);
|
|
}
|
|
}
|
|
}
|
|
static ɵfac = function BrowserModule_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _BrowserModule)();
|
|
};
|
|
static ɵmod = ɵɵdefineNgModule({
|
|
type: _BrowserModule,
|
|
exports: [CommonModule, ApplicationModule]
|
|
});
|
|
static ɵinj = ɵɵdefineInjector({
|
|
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
|
|
imports: [CommonModule, ApplicationModule]
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserModule, [{
|
|
type: NgModule,
|
|
args: [{
|
|
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
|
|
exports: [CommonModule, ApplicationModule]
|
|
}]
|
|
}], () => [], null);
|
|
})();
|
|
|
|
// node_modules/@angular/common/fesm2022/_module-chunk.mjs
|
|
var HttpHeaders = class _HttpHeaders {
|
|
headers;
|
|
normalizedNames = /* @__PURE__ */ new Map();
|
|
lazyInit;
|
|
lazyUpdate = null;
|
|
constructor(headers) {
|
|
if (!headers) {
|
|
this.headers = /* @__PURE__ */ new Map();
|
|
} else if (typeof headers === "string") {
|
|
this.lazyInit = () => {
|
|
this.headers = /* @__PURE__ */ new Map();
|
|
headers.split("\n").forEach((line) => {
|
|
const index = line.indexOf(":");
|
|
if (index > 0) {
|
|
const name = line.slice(0, index);
|
|
const value = line.slice(index + 1).trim();
|
|
this.addHeaderEntry(name, value);
|
|
}
|
|
});
|
|
};
|
|
} else if (typeof Headers !== "undefined" && headers instanceof Headers) {
|
|
this.headers = /* @__PURE__ */ new Map();
|
|
headers.forEach((value, name) => {
|
|
this.addHeaderEntry(name, value);
|
|
});
|
|
} else {
|
|
this.lazyInit = () => {
|
|
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
assertValidHeaders(headers);
|
|
}
|
|
this.headers = /* @__PURE__ */ new Map();
|
|
Object.entries(headers).forEach(([name, values]) => {
|
|
this.setHeaderEntries(name, values);
|
|
});
|
|
};
|
|
}
|
|
}
|
|
has(name) {
|
|
this.init();
|
|
return this.headers.has(name.toLowerCase());
|
|
}
|
|
get(name) {
|
|
this.init();
|
|
const values = this.headers.get(name.toLowerCase());
|
|
return values && values.length > 0 ? values[0] : null;
|
|
}
|
|
keys() {
|
|
this.init();
|
|
return Array.from(this.normalizedNames.values());
|
|
}
|
|
getAll(name) {
|
|
this.init();
|
|
return this.headers.get(name.toLowerCase()) || null;
|
|
}
|
|
append(name, value) {
|
|
return this.clone({
|
|
name,
|
|
value,
|
|
op: "a"
|
|
});
|
|
}
|
|
set(name, value) {
|
|
return this.clone({
|
|
name,
|
|
value,
|
|
op: "s"
|
|
});
|
|
}
|
|
delete(name, value) {
|
|
return this.clone({
|
|
name,
|
|
value,
|
|
op: "d"
|
|
});
|
|
}
|
|
maybeSetNormalizedName(name, lcName) {
|
|
if (!this.normalizedNames.has(lcName)) {
|
|
this.normalizedNames.set(lcName, name);
|
|
}
|
|
}
|
|
init() {
|
|
if (!!this.lazyInit) {
|
|
if (this.lazyInit instanceof _HttpHeaders) {
|
|
this.copyFrom(this.lazyInit);
|
|
} else {
|
|
this.lazyInit();
|
|
}
|
|
this.lazyInit = null;
|
|
if (!!this.lazyUpdate) {
|
|
this.lazyUpdate.forEach((update) => this.applyUpdate(update));
|
|
this.lazyUpdate = null;
|
|
}
|
|
}
|
|
}
|
|
copyFrom(other) {
|
|
other.init();
|
|
Array.from(other.headers.keys()).forEach((key) => {
|
|
this.headers.set(key, other.headers.get(key));
|
|
this.normalizedNames.set(key, other.normalizedNames.get(key));
|
|
});
|
|
}
|
|
clone(update) {
|
|
const clone = new _HttpHeaders();
|
|
clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof _HttpHeaders ? this.lazyInit : this;
|
|
clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
|
|
return clone;
|
|
}
|
|
applyUpdate(update) {
|
|
const key = update.name.toLowerCase();
|
|
switch (update.op) {
|
|
case "a":
|
|
case "s":
|
|
let value = update.value;
|
|
if (typeof value === "string") {
|
|
value = [value];
|
|
}
|
|
if (value.length === 0) {
|
|
return;
|
|
}
|
|
this.maybeSetNormalizedName(update.name, key);
|
|
const base = (update.op === "a" ? this.headers.get(key) : void 0) || [];
|
|
base.push(...value);
|
|
this.headers.set(key, base);
|
|
break;
|
|
case "d":
|
|
const toDelete = update.value;
|
|
if (!toDelete) {
|
|
this.headers.delete(key);
|
|
this.normalizedNames.delete(key);
|
|
} else {
|
|
let existing = this.headers.get(key);
|
|
if (!existing) {
|
|
return;
|
|
}
|
|
existing = existing.filter((value2) => toDelete.indexOf(value2) === -1);
|
|
if (existing.length === 0) {
|
|
this.headers.delete(key);
|
|
this.normalizedNames.delete(key);
|
|
} else {
|
|
this.headers.set(key, existing);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
addHeaderEntry(name, value) {
|
|
const key = name.toLowerCase();
|
|
this.maybeSetNormalizedName(name, key);
|
|
if (this.headers.has(key)) {
|
|
this.headers.get(key).push(value);
|
|
} else {
|
|
this.headers.set(key, [value]);
|
|
}
|
|
}
|
|
setHeaderEntries(name, values) {
|
|
const headerValues = (Array.isArray(values) ? values : [values]).map((value) => value.toString());
|
|
const key = name.toLowerCase();
|
|
this.headers.set(key, headerValues);
|
|
this.maybeSetNormalizedName(name, key);
|
|
}
|
|
forEach(fn) {
|
|
this.init();
|
|
Array.from(this.normalizedNames.keys()).forEach((key) => fn(this.normalizedNames.get(key), this.headers.get(key)));
|
|
}
|
|
};
|
|
function assertValidHeaders(headers) {
|
|
for (const [key, value] of Object.entries(headers)) {
|
|
if (!(typeof value === "string" || typeof value === "number") && !Array.isArray(value)) {
|
|
throw new Error(`Unexpected value of the \`${key}\` header provided. Expecting either a string, a number or an array, but got: \`${value}\`.`);
|
|
}
|
|
}
|
|
}
|
|
var HttpContext = class {
|
|
map = /* @__PURE__ */ new Map();
|
|
set(token, value) {
|
|
this.map.set(token, value);
|
|
return this;
|
|
}
|
|
get(token) {
|
|
if (!this.map.has(token)) {
|
|
this.map.set(token, token.defaultValue());
|
|
}
|
|
return this.map.get(token);
|
|
}
|
|
delete(token) {
|
|
this.map.delete(token);
|
|
return this;
|
|
}
|
|
has(token) {
|
|
return this.map.has(token);
|
|
}
|
|
keys() {
|
|
return this.map.keys();
|
|
}
|
|
};
|
|
var HttpUrlEncodingCodec = class {
|
|
encodeKey(key) {
|
|
return standardEncoding(key);
|
|
}
|
|
encodeValue(value) {
|
|
return standardEncoding(value);
|
|
}
|
|
decodeKey(key) {
|
|
return decodeURIComponent(key);
|
|
}
|
|
decodeValue(value) {
|
|
return decodeURIComponent(value);
|
|
}
|
|
};
|
|
function paramParser(rawParams, codec) {
|
|
const map2 = /* @__PURE__ */ new Map();
|
|
if (rawParams.length > 0) {
|
|
const params = rawParams.replace(/^\?/, "").split("&");
|
|
params.forEach((param) => {
|
|
const eqIdx = param.indexOf("=");
|
|
const [key, val] = eqIdx == -1 ? [codec.decodeKey(param), ""] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];
|
|
const list = map2.get(key) || [];
|
|
list.push(val);
|
|
map2.set(key, list);
|
|
});
|
|
}
|
|
return map2;
|
|
}
|
|
var STANDARD_ENCODING_REGEX = /%(\d[a-f0-9])/gi;
|
|
var STANDARD_ENCODING_REPLACEMENTS = {
|
|
"40": "@",
|
|
"3A": ":",
|
|
"24": "$",
|
|
"2C": ",",
|
|
"3B": ";",
|
|
"3D": "=",
|
|
"3F": "?",
|
|
"2F": "/"
|
|
};
|
|
function standardEncoding(v) {
|
|
return encodeURIComponent(v).replace(STANDARD_ENCODING_REGEX, (s, t) => STANDARD_ENCODING_REPLACEMENTS[t] ?? s);
|
|
}
|
|
function valueToString(value) {
|
|
return `${value}`;
|
|
}
|
|
var HttpParams = class _HttpParams {
|
|
map;
|
|
encoder;
|
|
updates = null;
|
|
cloneFrom = null;
|
|
constructor(options = {}) {
|
|
this.encoder = options.encoder || new HttpUrlEncodingCodec();
|
|
if (options.fromString) {
|
|
if (options.fromObject) {
|
|
throw new RuntimeError(2805, ngDevMode && "Cannot specify both fromString and fromObject.");
|
|
}
|
|
this.map = paramParser(options.fromString, this.encoder);
|
|
} else if (!!options.fromObject) {
|
|
this.map = /* @__PURE__ */ new Map();
|
|
Object.keys(options.fromObject).forEach((key) => {
|
|
const value = options.fromObject[key];
|
|
const values = Array.isArray(value) ? value.map(valueToString) : [valueToString(value)];
|
|
this.map.set(key, values);
|
|
});
|
|
} else {
|
|
this.map = null;
|
|
}
|
|
}
|
|
has(param) {
|
|
this.init();
|
|
return this.map.has(param);
|
|
}
|
|
get(param) {
|
|
this.init();
|
|
const res = this.map.get(param);
|
|
return !!res ? res[0] : null;
|
|
}
|
|
getAll(param) {
|
|
this.init();
|
|
return this.map.get(param) || null;
|
|
}
|
|
keys() {
|
|
this.init();
|
|
return Array.from(this.map.keys());
|
|
}
|
|
append(param, value) {
|
|
return this.clone({
|
|
param,
|
|
value,
|
|
op: "a"
|
|
});
|
|
}
|
|
appendAll(params) {
|
|
const updates = [];
|
|
Object.keys(params).forEach((param) => {
|
|
const value = params[param];
|
|
if (Array.isArray(value)) {
|
|
value.forEach((_value) => {
|
|
updates.push({
|
|
param,
|
|
value: _value,
|
|
op: "a"
|
|
});
|
|
});
|
|
} else {
|
|
updates.push({
|
|
param,
|
|
value,
|
|
op: "a"
|
|
});
|
|
}
|
|
});
|
|
return this.clone(updates);
|
|
}
|
|
set(param, value) {
|
|
return this.clone({
|
|
param,
|
|
value,
|
|
op: "s"
|
|
});
|
|
}
|
|
delete(param, value) {
|
|
return this.clone({
|
|
param,
|
|
value,
|
|
op: "d"
|
|
});
|
|
}
|
|
toString() {
|
|
this.init();
|
|
return this.keys().map((key) => {
|
|
const eKey = this.encoder.encodeKey(key);
|
|
return this.map.get(key).map((value) => eKey + "=" + this.encoder.encodeValue(value)).join("&");
|
|
}).filter((param) => param !== "").join("&");
|
|
}
|
|
clone(update) {
|
|
const clone = new _HttpParams({
|
|
encoder: this.encoder
|
|
});
|
|
clone.cloneFrom = this.cloneFrom || this;
|
|
clone.updates = (this.updates || []).concat(update);
|
|
return clone;
|
|
}
|
|
init() {
|
|
if (this.map === null) {
|
|
this.map = /* @__PURE__ */ new Map();
|
|
}
|
|
if (this.cloneFrom !== null) {
|
|
this.cloneFrom.init();
|
|
this.cloneFrom.keys().forEach((key) => this.map.set(key, this.cloneFrom.map.get(key)));
|
|
this.updates.forEach((update) => {
|
|
switch (update.op) {
|
|
case "a":
|
|
case "s":
|
|
const base = (update.op === "a" ? this.map.get(update.param) : void 0) || [];
|
|
base.push(valueToString(update.value));
|
|
this.map.set(update.param, base);
|
|
break;
|
|
case "d":
|
|
if (update.value !== void 0) {
|
|
let base2 = this.map.get(update.param) || [];
|
|
const idx = base2.indexOf(valueToString(update.value));
|
|
if (idx !== -1) {
|
|
base2.splice(idx, 1);
|
|
}
|
|
if (base2.length > 0) {
|
|
this.map.set(update.param, base2);
|
|
} else {
|
|
this.map.delete(update.param);
|
|
}
|
|
} else {
|
|
this.map.delete(update.param);
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
this.cloneFrom = this.updates = null;
|
|
}
|
|
}
|
|
};
|
|
function mightHaveBody(method) {
|
|
switch (method) {
|
|
case "DELETE":
|
|
case "GET":
|
|
case "HEAD":
|
|
case "OPTIONS":
|
|
case "JSONP":
|
|
return false;
|
|
default:
|
|
return true;
|
|
}
|
|
}
|
|
function isArrayBuffer(value) {
|
|
return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
|
|
}
|
|
function isBlob(value) {
|
|
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
}
|
|
function isFormData(value) {
|
|
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
}
|
|
function isUrlSearchParams(value) {
|
|
return typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams;
|
|
}
|
|
var CONTENT_TYPE_HEADER = "Content-Type";
|
|
var ACCEPT_HEADER = "Accept";
|
|
var TEXT_CONTENT_TYPE = "text/plain";
|
|
var JSON_CONTENT_TYPE = "application/json";
|
|
var ACCEPT_HEADER_VALUE = `${JSON_CONTENT_TYPE}, ${TEXT_CONTENT_TYPE}, */*`;
|
|
var HttpRequest = class _HttpRequest {
|
|
url;
|
|
body = null;
|
|
headers;
|
|
context;
|
|
reportProgress = false;
|
|
withCredentials = false;
|
|
credentials;
|
|
keepalive = false;
|
|
cache;
|
|
priority;
|
|
mode;
|
|
redirect;
|
|
referrer;
|
|
integrity;
|
|
referrerPolicy;
|
|
responseType = "json";
|
|
method;
|
|
params;
|
|
urlWithParams;
|
|
transferCache;
|
|
timeout;
|
|
constructor(method, url, third, fourth) {
|
|
this.url = url;
|
|
this.method = method.toUpperCase();
|
|
let options;
|
|
if (mightHaveBody(this.method) || !!fourth) {
|
|
this.body = third !== void 0 ? third : null;
|
|
options = fourth;
|
|
} else {
|
|
options = third;
|
|
}
|
|
if (options) {
|
|
this.reportProgress = !!options.reportProgress;
|
|
this.withCredentials = !!options.withCredentials;
|
|
this.keepalive = !!options.keepalive;
|
|
if (!!options.responseType) {
|
|
this.responseType = options.responseType;
|
|
}
|
|
if (options.headers) {
|
|
this.headers = options.headers;
|
|
}
|
|
if (options.context) {
|
|
this.context = options.context;
|
|
}
|
|
if (options.params) {
|
|
this.params = options.params;
|
|
}
|
|
if (options.priority) {
|
|
this.priority = options.priority;
|
|
}
|
|
if (options.cache) {
|
|
this.cache = options.cache;
|
|
}
|
|
if (options.credentials) {
|
|
this.credentials = options.credentials;
|
|
}
|
|
if (typeof options.timeout === "number") {
|
|
if (options.timeout < 1 || !Number.isInteger(options.timeout)) {
|
|
throw new RuntimeError(2822, ngDevMode ? "`timeout` must be a positive integer value" : "");
|
|
}
|
|
this.timeout = options.timeout;
|
|
}
|
|
if (options.mode) {
|
|
this.mode = options.mode;
|
|
}
|
|
if (options.redirect) {
|
|
this.redirect = options.redirect;
|
|
}
|
|
if (options.integrity) {
|
|
this.integrity = options.integrity;
|
|
}
|
|
if (options.referrer) {
|
|
this.referrer = options.referrer;
|
|
}
|
|
if (options.referrerPolicy) {
|
|
this.referrerPolicy = options.referrerPolicy;
|
|
}
|
|
this.transferCache = options.transferCache;
|
|
}
|
|
this.headers ??= new HttpHeaders();
|
|
this.context ??= new HttpContext();
|
|
if (!this.params) {
|
|
this.params = new HttpParams();
|
|
this.urlWithParams = url;
|
|
} else {
|
|
const params = this.params.toString();
|
|
if (params.length === 0) {
|
|
this.urlWithParams = url;
|
|
} else {
|
|
const qIdx = url.indexOf("?");
|
|
const sep = qIdx === -1 ? "?" : qIdx < url.length - 1 ? "&" : "";
|
|
this.urlWithParams = url + sep + params;
|
|
}
|
|
}
|
|
}
|
|
serializeBody() {
|
|
if (this.body === null) {
|
|
return null;
|
|
}
|
|
if (typeof this.body === "string" || isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || isUrlSearchParams(this.body)) {
|
|
return this.body;
|
|
}
|
|
if (this.body instanceof HttpParams) {
|
|
return this.body.toString();
|
|
}
|
|
if (typeof this.body === "object" || typeof this.body === "boolean" || Array.isArray(this.body)) {
|
|
return JSON.stringify(this.body);
|
|
}
|
|
return this.body.toString();
|
|
}
|
|
detectContentTypeHeader() {
|
|
if (this.body === null) {
|
|
return null;
|
|
}
|
|
if (isFormData(this.body)) {
|
|
return null;
|
|
}
|
|
if (isBlob(this.body)) {
|
|
return this.body.type || null;
|
|
}
|
|
if (isArrayBuffer(this.body)) {
|
|
return null;
|
|
}
|
|
if (typeof this.body === "string") {
|
|
return TEXT_CONTENT_TYPE;
|
|
}
|
|
if (this.body instanceof HttpParams) {
|
|
return "application/x-www-form-urlencoded;charset=UTF-8";
|
|
}
|
|
if (typeof this.body === "object" || typeof this.body === "number" || typeof this.body === "boolean") {
|
|
return JSON_CONTENT_TYPE;
|
|
}
|
|
return null;
|
|
}
|
|
clone(update = {}) {
|
|
const method = update.method || this.method;
|
|
const url = update.url || this.url;
|
|
const responseType = update.responseType || this.responseType;
|
|
const keepalive = update.keepalive ?? this.keepalive;
|
|
const priority = update.priority || this.priority;
|
|
const cache = update.cache || this.cache;
|
|
const mode = update.mode || this.mode;
|
|
const redirect = update.redirect || this.redirect;
|
|
const credentials = update.credentials || this.credentials;
|
|
const referrer = update.referrer || this.referrer;
|
|
const integrity = update.integrity || this.integrity;
|
|
const referrerPolicy = update.referrerPolicy || this.referrerPolicy;
|
|
const transferCache = update.transferCache ?? this.transferCache;
|
|
const timeout = update.timeout ?? this.timeout;
|
|
const body = update.body !== void 0 ? update.body : this.body;
|
|
const withCredentials = update.withCredentials ?? this.withCredentials;
|
|
const reportProgress = update.reportProgress ?? this.reportProgress;
|
|
let headers = update.headers || this.headers;
|
|
let params = update.params || this.params;
|
|
const context = update.context ?? this.context;
|
|
if (update.setHeaders !== void 0) {
|
|
headers = Object.keys(update.setHeaders).reduce((headers2, name) => headers2.set(name, update.setHeaders[name]), headers);
|
|
}
|
|
if (update.setParams) {
|
|
params = Object.keys(update.setParams).reduce((params2, param) => params2.set(param, update.setParams[param]), params);
|
|
}
|
|
return new _HttpRequest(method, url, body, {
|
|
params,
|
|
headers,
|
|
context,
|
|
reportProgress,
|
|
responseType,
|
|
withCredentials,
|
|
transferCache,
|
|
keepalive,
|
|
cache,
|
|
priority,
|
|
timeout,
|
|
mode,
|
|
redirect,
|
|
credentials,
|
|
referrer,
|
|
integrity,
|
|
referrerPolicy
|
|
});
|
|
}
|
|
};
|
|
var HttpEventType;
|
|
(function(HttpEventType2) {
|
|
HttpEventType2[HttpEventType2["Sent"] = 0] = "Sent";
|
|
HttpEventType2[HttpEventType2["UploadProgress"] = 1] = "UploadProgress";
|
|
HttpEventType2[HttpEventType2["ResponseHeader"] = 2] = "ResponseHeader";
|
|
HttpEventType2[HttpEventType2["DownloadProgress"] = 3] = "DownloadProgress";
|
|
HttpEventType2[HttpEventType2["Response"] = 4] = "Response";
|
|
HttpEventType2[HttpEventType2["User"] = 5] = "User";
|
|
})(HttpEventType || (HttpEventType = {}));
|
|
var HttpResponseBase = class {
|
|
headers;
|
|
status;
|
|
statusText;
|
|
url;
|
|
ok;
|
|
type;
|
|
redirected;
|
|
responseType;
|
|
constructor(init, defaultStatus = 200, defaultStatusText = "OK") {
|
|
this.headers = init.headers || new HttpHeaders();
|
|
this.status = init.status !== void 0 ? init.status : defaultStatus;
|
|
this.statusText = init.statusText || defaultStatusText;
|
|
this.url = init.url || null;
|
|
this.redirected = init.redirected;
|
|
this.responseType = init.responseType;
|
|
this.ok = this.status >= 200 && this.status < 300;
|
|
}
|
|
};
|
|
var HttpHeaderResponse = class _HttpHeaderResponse extends HttpResponseBase {
|
|
constructor(init = {}) {
|
|
super(init);
|
|
}
|
|
type = HttpEventType.ResponseHeader;
|
|
clone(update = {}) {
|
|
return new _HttpHeaderResponse({
|
|
headers: update.headers || this.headers,
|
|
status: update.status !== void 0 ? update.status : this.status,
|
|
statusText: update.statusText || this.statusText,
|
|
url: update.url || this.url || void 0
|
|
});
|
|
}
|
|
};
|
|
var HttpResponse = class _HttpResponse extends HttpResponseBase {
|
|
body;
|
|
constructor(init = {}) {
|
|
super(init);
|
|
this.body = init.body !== void 0 ? init.body : null;
|
|
}
|
|
type = HttpEventType.Response;
|
|
clone(update = {}) {
|
|
return new _HttpResponse({
|
|
body: update.body !== void 0 ? update.body : this.body,
|
|
headers: update.headers || this.headers,
|
|
status: update.status !== void 0 ? update.status : this.status,
|
|
statusText: update.statusText || this.statusText,
|
|
url: update.url || this.url || void 0,
|
|
redirected: update.redirected ?? this.redirected,
|
|
responseType: update.responseType ?? this.responseType
|
|
});
|
|
}
|
|
};
|
|
var HttpErrorResponse = class extends HttpResponseBase {
|
|
name = "HttpErrorResponse";
|
|
message;
|
|
error;
|
|
ok = false;
|
|
constructor(init) {
|
|
super(init, 0, "Unknown Error");
|
|
if (this.status >= 200 && this.status < 300) {
|
|
this.message = `Http failure during parsing for ${init.url || "(unknown url)"}`;
|
|
} else {
|
|
this.message = `Http failure response for ${init.url || "(unknown url)"}: ${init.status} ${init.statusText}`;
|
|
}
|
|
this.error = init.error || null;
|
|
}
|
|
};
|
|
var HTTP_STATUS_CODE_OK = 200;
|
|
var HTTP_STATUS_CODE_NO_CONTENT = 204;
|
|
var HttpStatusCode;
|
|
(function(HttpStatusCode2) {
|
|
HttpStatusCode2[HttpStatusCode2["Continue"] = 100] = "Continue";
|
|
HttpStatusCode2[HttpStatusCode2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
HttpStatusCode2[HttpStatusCode2["Processing"] = 102] = "Processing";
|
|
HttpStatusCode2[HttpStatusCode2["EarlyHints"] = 103] = "EarlyHints";
|
|
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
HttpStatusCode2[HttpStatusCode2["Accepted"] = 202] = "Accepted";
|
|
HttpStatusCode2[HttpStatusCode2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
|
|
HttpStatusCode2[HttpStatusCode2["ResetContent"] = 205] = "ResetContent";
|
|
HttpStatusCode2[HttpStatusCode2["PartialContent"] = 206] = "PartialContent";
|
|
HttpStatusCode2[HttpStatusCode2["MultiStatus"] = 207] = "MultiStatus";
|
|
HttpStatusCode2[HttpStatusCode2["AlreadyReported"] = 208] = "AlreadyReported";
|
|
HttpStatusCode2[HttpStatusCode2["ImUsed"] = 226] = "ImUsed";
|
|
HttpStatusCode2[HttpStatusCode2["MultipleChoices"] = 300] = "MultipleChoices";
|
|
HttpStatusCode2[HttpStatusCode2["MovedPermanently"] = 301] = "MovedPermanently";
|
|
HttpStatusCode2[HttpStatusCode2["Found"] = 302] = "Found";
|
|
HttpStatusCode2[HttpStatusCode2["SeeOther"] = 303] = "SeeOther";
|
|
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
|
|
HttpStatusCode2[HttpStatusCode2["UseProxy"] = 305] = "UseProxy";
|
|
HttpStatusCode2[HttpStatusCode2["Unused"] = 306] = "Unused";
|
|
HttpStatusCode2[HttpStatusCode2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
HttpStatusCode2[HttpStatusCode2["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
|
|
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
|
|
HttpStatusCode2[HttpStatusCode2["PaymentRequired"] = 402] = "PaymentRequired";
|
|
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
|
|
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
|
|
HttpStatusCode2[HttpStatusCode2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
HttpStatusCode2[HttpStatusCode2["NotAcceptable"] = 406] = "NotAcceptable";
|
|
HttpStatusCode2[HttpStatusCode2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
HttpStatusCode2[HttpStatusCode2["RequestTimeout"] = 408] = "RequestTimeout";
|
|
HttpStatusCode2[HttpStatusCode2["Conflict"] = 409] = "Conflict";
|
|
HttpStatusCode2[HttpStatusCode2["Gone"] = 410] = "Gone";
|
|
HttpStatusCode2[HttpStatusCode2["LengthRequired"] = 411] = "LengthRequired";
|
|
HttpStatusCode2[HttpStatusCode2["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
HttpStatusCode2[HttpStatusCode2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
HttpStatusCode2[HttpStatusCode2["UriTooLong"] = 414] = "UriTooLong";
|
|
HttpStatusCode2[HttpStatusCode2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
HttpStatusCode2[HttpStatusCode2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
HttpStatusCode2[HttpStatusCode2["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
HttpStatusCode2[HttpStatusCode2["ImATeapot"] = 418] = "ImATeapot";
|
|
HttpStatusCode2[HttpStatusCode2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
HttpStatusCode2[HttpStatusCode2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
HttpStatusCode2[HttpStatusCode2["Locked"] = 423] = "Locked";
|
|
HttpStatusCode2[HttpStatusCode2["FailedDependency"] = 424] = "FailedDependency";
|
|
HttpStatusCode2[HttpStatusCode2["TooEarly"] = 425] = "TooEarly";
|
|
HttpStatusCode2[HttpStatusCode2["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
HttpStatusCode2[HttpStatusCode2["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
HttpStatusCode2[HttpStatusCode2["TooManyRequests"] = 429] = "TooManyRequests";
|
|
HttpStatusCode2[HttpStatusCode2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
HttpStatusCode2[HttpStatusCode2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
HttpStatusCode2[HttpStatusCode2["InternalServerError"] = 500] = "InternalServerError";
|
|
HttpStatusCode2[HttpStatusCode2["NotImplemented"] = 501] = "NotImplemented";
|
|
HttpStatusCode2[HttpStatusCode2["BadGateway"] = 502] = "BadGateway";
|
|
HttpStatusCode2[HttpStatusCode2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
HttpStatusCode2[HttpStatusCode2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
|
|
HttpStatusCode2[HttpStatusCode2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
HttpStatusCode2[HttpStatusCode2["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
HttpStatusCode2[HttpStatusCode2["LoopDetected"] = 508] = "LoopDetected";
|
|
HttpStatusCode2[HttpStatusCode2["NotExtended"] = 510] = "NotExtended";
|
|
HttpStatusCode2[HttpStatusCode2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
var XSSI_PREFIX$1 = /^\)\]\}',?\n/;
|
|
var FETCH_BACKEND = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "FETCH_BACKEND" : "");
|
|
var FetchBackend = class _FetchBackend {
|
|
fetchImpl = inject(FetchFactory, {
|
|
optional: true
|
|
})?.fetch ?? ((...args) => globalThis.fetch(...args));
|
|
ngZone = inject(NgZone);
|
|
destroyRef = inject(DestroyRef);
|
|
handle(request) {
|
|
return new Observable((observer) => {
|
|
const aborter = new AbortController();
|
|
this.doRequest(request, aborter.signal, observer).then(noop, (error) => observer.error(new HttpErrorResponse({
|
|
error
|
|
})));
|
|
let timeoutId;
|
|
if (request.timeout) {
|
|
timeoutId = this.ngZone.runOutsideAngular(() => setTimeout(() => {
|
|
if (!aborter.signal.aborted) {
|
|
aborter.abort(new DOMException("signal timed out", "TimeoutError"));
|
|
}
|
|
}, request.timeout));
|
|
}
|
|
return () => {
|
|
if (timeoutId !== void 0) {
|
|
clearTimeout(timeoutId);
|
|
}
|
|
aborter.abort();
|
|
};
|
|
});
|
|
}
|
|
async doRequest(request, signal2, observer) {
|
|
const init = this.createRequestInit(request);
|
|
let response;
|
|
try {
|
|
const fetchPromise = this.ngZone.runOutsideAngular(() => this.fetchImpl(request.urlWithParams, __spreadValues({
|
|
signal: signal2
|
|
}, init)));
|
|
silenceSuperfluousUnhandledPromiseRejection(fetchPromise);
|
|
observer.next({
|
|
type: HttpEventType.Sent
|
|
});
|
|
response = await fetchPromise;
|
|
} catch (error) {
|
|
observer.error(new HttpErrorResponse({
|
|
error,
|
|
status: error.status ?? 0,
|
|
statusText: error.statusText,
|
|
url: request.urlWithParams,
|
|
headers: error.headers
|
|
}));
|
|
return;
|
|
}
|
|
const headers = new HttpHeaders(response.headers);
|
|
const statusText = response.statusText;
|
|
const url = response.url || request.urlWithParams;
|
|
let status = response.status;
|
|
let body = null;
|
|
if (request.reportProgress) {
|
|
observer.next(new HttpHeaderResponse({
|
|
headers,
|
|
status,
|
|
statusText,
|
|
url
|
|
}));
|
|
}
|
|
if (response.body) {
|
|
const contentLength = response.headers.get("content-length");
|
|
const chunks = [];
|
|
const reader = response.body.getReader();
|
|
let receivedLength = 0;
|
|
let decoder;
|
|
let partialText;
|
|
const reqZone = typeof Zone !== "undefined" && Zone.current;
|
|
let canceled = false;
|
|
await this.ngZone.runOutsideAngular(async () => {
|
|
while (true) {
|
|
if (this.destroyRef.destroyed) {
|
|
await reader.cancel();
|
|
canceled = true;
|
|
break;
|
|
}
|
|
const {
|
|
done,
|
|
value
|
|
} = await reader.read();
|
|
if (done) {
|
|
break;
|
|
}
|
|
chunks.push(value);
|
|
receivedLength += value.length;
|
|
if (request.reportProgress) {
|
|
partialText = request.responseType === "text" ? (partialText ?? "") + (decoder ??= new TextDecoder()).decode(value, {
|
|
stream: true
|
|
}) : void 0;
|
|
const reportProgress = () => observer.next({
|
|
type: HttpEventType.DownloadProgress,
|
|
total: contentLength ? +contentLength : void 0,
|
|
loaded: receivedLength,
|
|
partialText
|
|
});
|
|
reqZone ? reqZone.run(reportProgress) : reportProgress();
|
|
}
|
|
}
|
|
});
|
|
if (canceled) {
|
|
observer.complete();
|
|
return;
|
|
}
|
|
const chunksAll = this.concatChunks(chunks, receivedLength);
|
|
try {
|
|
const contentType = response.headers.get(CONTENT_TYPE_HEADER) ?? "";
|
|
body = this.parseBody(request, chunksAll, contentType, status);
|
|
} catch (error) {
|
|
observer.error(new HttpErrorResponse({
|
|
error,
|
|
headers: new HttpHeaders(response.headers),
|
|
status: response.status,
|
|
statusText: response.statusText,
|
|
url: response.url || request.urlWithParams
|
|
}));
|
|
return;
|
|
}
|
|
}
|
|
if (status === 0) {
|
|
status = body ? HTTP_STATUS_CODE_OK : 0;
|
|
}
|
|
const ok = status >= 200 && status < 300;
|
|
const redirected = response.redirected;
|
|
const responseType = response.type;
|
|
if (ok) {
|
|
observer.next(new HttpResponse({
|
|
body,
|
|
headers,
|
|
status,
|
|
statusText,
|
|
url,
|
|
redirected,
|
|
responseType
|
|
}));
|
|
observer.complete();
|
|
} else {
|
|
observer.error(new HttpErrorResponse({
|
|
error: body,
|
|
headers,
|
|
status,
|
|
statusText,
|
|
url,
|
|
redirected,
|
|
responseType
|
|
}));
|
|
}
|
|
}
|
|
parseBody(request, binContent, contentType, status) {
|
|
switch (request.responseType) {
|
|
case "json":
|
|
const text = new TextDecoder().decode(binContent).replace(XSSI_PREFIX$1, "");
|
|
if (text === "") {
|
|
return null;
|
|
}
|
|
try {
|
|
return JSON.parse(text);
|
|
} catch (e) {
|
|
if (status < 200 || status >= 300) {
|
|
return text;
|
|
}
|
|
throw e;
|
|
}
|
|
case "text":
|
|
return new TextDecoder().decode(binContent);
|
|
case "blob":
|
|
return new Blob([binContent], {
|
|
type: contentType
|
|
});
|
|
case "arraybuffer":
|
|
return binContent.buffer;
|
|
}
|
|
}
|
|
createRequestInit(req) {
|
|
const headers = {};
|
|
let credentials;
|
|
credentials = req.credentials;
|
|
if (req.withCredentials) {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && warningOptionsMessage(req);
|
|
credentials = "include";
|
|
}
|
|
req.headers.forEach((name, values) => headers[name] = values.join(","));
|
|
if (!req.headers.has(ACCEPT_HEADER)) {
|
|
headers[ACCEPT_HEADER] = ACCEPT_HEADER_VALUE;
|
|
}
|
|
if (!req.headers.has(CONTENT_TYPE_HEADER)) {
|
|
const detectedType = req.detectContentTypeHeader();
|
|
if (detectedType !== null) {
|
|
headers[CONTENT_TYPE_HEADER] = detectedType;
|
|
}
|
|
}
|
|
return {
|
|
body: req.serializeBody(),
|
|
method: req.method,
|
|
headers,
|
|
credentials,
|
|
keepalive: req.keepalive,
|
|
cache: req.cache,
|
|
priority: req.priority,
|
|
mode: req.mode,
|
|
redirect: req.redirect,
|
|
referrer: req.referrer,
|
|
integrity: req.integrity,
|
|
referrerPolicy: req.referrerPolicy
|
|
};
|
|
}
|
|
concatChunks(chunks, totalLength) {
|
|
const chunksAll = new Uint8Array(totalLength);
|
|
let position = 0;
|
|
for (const chunk of chunks) {
|
|
chunksAll.set(chunk, position);
|
|
position += chunk.length;
|
|
}
|
|
return chunksAll;
|
|
}
|
|
static ɵfac = function FetchBackend_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _FetchBackend)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _FetchBackend,
|
|
factory: _FetchBackend.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FetchBackend, [{
|
|
type: Injectable
|
|
}], null, null);
|
|
})();
|
|
var FetchFactory = class {
|
|
};
|
|
function noop() {
|
|
}
|
|
function warningOptionsMessage(req) {
|
|
if (req.credentials && req.withCredentials) {
|
|
console.warn(formatRuntimeError(2819, `Angular detected that a \`HttpClient\` request has both \`withCredentials: true\` and \`credentials: '${req.credentials}'\` options. The \`withCredentials\` option is overriding the explicit \`credentials\` setting to 'include'. Consider removing \`withCredentials\` and using \`credentials: '${req.credentials}'\` directly for clarity.`));
|
|
}
|
|
}
|
|
function silenceSuperfluousUnhandledPromiseRejection(promise) {
|
|
promise.then(noop, noop);
|
|
}
|
|
var XSSI_PREFIX = /^\)\]\}',?\n/;
|
|
function validateXhrCompatibility(req) {
|
|
const unsupportedOptions = [{
|
|
property: "keepalive",
|
|
errorCode: 2813
|
|
}, {
|
|
property: "cache",
|
|
errorCode: 2814
|
|
}, {
|
|
property: "priority",
|
|
errorCode: 2815
|
|
}, {
|
|
property: "mode",
|
|
errorCode: 2816
|
|
}, {
|
|
property: "redirect",
|
|
errorCode: 2817
|
|
}, {
|
|
property: "credentials",
|
|
errorCode: 2818
|
|
}, {
|
|
property: "integrity",
|
|
errorCode: 2820
|
|
}, {
|
|
property: "referrer",
|
|
errorCode: 2821
|
|
}, {
|
|
property: "referrerPolicy",
|
|
errorCode: 2823
|
|
}];
|
|
for (const {
|
|
property,
|
|
errorCode
|
|
} of unsupportedOptions) {
|
|
if (req[property]) {
|
|
console.warn(formatRuntimeError(errorCode, `Angular detected that a \`HttpClient\` request with the \`${property}\` option was sent using XHR, which does not support it. To use the \`${property}\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
|
|
}
|
|
}
|
|
}
|
|
var HttpXhrBackend = class _HttpXhrBackend {
|
|
xhrFactory;
|
|
tracingService = inject(TracingService, {
|
|
optional: true
|
|
});
|
|
constructor(xhrFactory) {
|
|
this.xhrFactory = xhrFactory;
|
|
}
|
|
maybePropagateTrace(fn) {
|
|
return this.tracingService?.propagate ? this.tracingService.propagate(fn) : fn;
|
|
}
|
|
handle(req) {
|
|
if (req.method === "JSONP") {
|
|
throw new RuntimeError(-2800, (typeof ngDevMode === "undefined" || ngDevMode) && `Cannot make a JSONP request without JSONP support. To fix the problem, either add the \`withJsonpSupport()\` call (if \`provideHttpClient()\` is used) or import the \`HttpClientJsonpModule\` in the root NgModule.`);
|
|
}
|
|
ngDevMode && validateXhrCompatibility(req);
|
|
const xhrFactory = this.xhrFactory;
|
|
const source = false ? from(xhrFactory.ɵloadImpl()) : of(null);
|
|
return source.pipe(switchMap(() => {
|
|
return new Observable((observer) => {
|
|
const xhr = xhrFactory.build();
|
|
xhr.open(req.method, req.urlWithParams);
|
|
if (req.withCredentials) {
|
|
xhr.withCredentials = true;
|
|
}
|
|
req.headers.forEach((name, values) => xhr.setRequestHeader(name, values.join(",")));
|
|
if (!req.headers.has(ACCEPT_HEADER)) {
|
|
xhr.setRequestHeader(ACCEPT_HEADER, ACCEPT_HEADER_VALUE);
|
|
}
|
|
if (!req.headers.has(CONTENT_TYPE_HEADER)) {
|
|
const detectedType = req.detectContentTypeHeader();
|
|
if (detectedType !== null) {
|
|
xhr.setRequestHeader(CONTENT_TYPE_HEADER, detectedType);
|
|
}
|
|
}
|
|
if (req.timeout) {
|
|
xhr.timeout = req.timeout;
|
|
}
|
|
if (req.responseType) {
|
|
const responseType = req.responseType.toLowerCase();
|
|
xhr.responseType = responseType !== "json" ? responseType : "text";
|
|
}
|
|
const reqBody = req.serializeBody();
|
|
let headerResponse = null;
|
|
const partialFromXhr = () => {
|
|
if (headerResponse !== null) {
|
|
return headerResponse;
|
|
}
|
|
const statusText = xhr.statusText || "OK";
|
|
const headers = new HttpHeaders(xhr.getAllResponseHeaders());
|
|
const url = xhr.responseURL || req.url;
|
|
headerResponse = new HttpHeaderResponse({
|
|
headers,
|
|
status: xhr.status,
|
|
statusText,
|
|
url
|
|
});
|
|
return headerResponse;
|
|
};
|
|
const onLoad = this.maybePropagateTrace(() => {
|
|
let {
|
|
headers,
|
|
status,
|
|
statusText,
|
|
url
|
|
} = partialFromXhr();
|
|
let body = null;
|
|
if (status !== HTTP_STATUS_CODE_NO_CONTENT) {
|
|
body = typeof xhr.response === "undefined" ? xhr.responseText : xhr.response;
|
|
}
|
|
if (status === 0) {
|
|
status = !!body ? HTTP_STATUS_CODE_OK : 0;
|
|
}
|
|
let ok = status >= 200 && status < 300;
|
|
if (req.responseType === "json" && typeof body === "string") {
|
|
const originalBody = body;
|
|
body = body.replace(XSSI_PREFIX, "");
|
|
try {
|
|
body = body !== "" ? JSON.parse(body) : null;
|
|
} catch (error) {
|
|
body = originalBody;
|
|
if (ok) {
|
|
ok = false;
|
|
body = {
|
|
error,
|
|
text: body
|
|
};
|
|
}
|
|
}
|
|
}
|
|
if (ok) {
|
|
observer.next(new HttpResponse({
|
|
body,
|
|
headers,
|
|
status,
|
|
statusText,
|
|
url: url || void 0
|
|
}));
|
|
observer.complete();
|
|
} else {
|
|
observer.error(new HttpErrorResponse({
|
|
error: body,
|
|
headers,
|
|
status,
|
|
statusText,
|
|
url: url || void 0
|
|
}));
|
|
}
|
|
});
|
|
const onError = this.maybePropagateTrace((error) => {
|
|
const {
|
|
url
|
|
} = partialFromXhr();
|
|
const res = new HttpErrorResponse({
|
|
error,
|
|
status: xhr.status || 0,
|
|
statusText: xhr.statusText || "Unknown Error",
|
|
url: url || void 0
|
|
});
|
|
observer.error(res);
|
|
});
|
|
let onTimeout = onError;
|
|
if (req.timeout) {
|
|
onTimeout = this.maybePropagateTrace((_) => {
|
|
const {
|
|
url
|
|
} = partialFromXhr();
|
|
const res = new HttpErrorResponse({
|
|
error: new DOMException("Request timed out", "TimeoutError"),
|
|
status: xhr.status || 0,
|
|
statusText: xhr.statusText || "Request timeout",
|
|
url: url || void 0
|
|
});
|
|
observer.error(res);
|
|
});
|
|
}
|
|
let sentHeaders = false;
|
|
const onDownProgress = this.maybePropagateTrace((event) => {
|
|
if (!sentHeaders) {
|
|
observer.next(partialFromXhr());
|
|
sentHeaders = true;
|
|
}
|
|
let progressEvent = {
|
|
type: HttpEventType.DownloadProgress,
|
|
loaded: event.loaded
|
|
};
|
|
if (event.lengthComputable) {
|
|
progressEvent.total = event.total;
|
|
}
|
|
if (req.responseType === "text" && !!xhr.responseText) {
|
|
progressEvent.partialText = xhr.responseText;
|
|
}
|
|
observer.next(progressEvent);
|
|
});
|
|
const onUpProgress = this.maybePropagateTrace((event) => {
|
|
let progress = {
|
|
type: HttpEventType.UploadProgress,
|
|
loaded: event.loaded
|
|
};
|
|
if (event.lengthComputable) {
|
|
progress.total = event.total;
|
|
}
|
|
observer.next(progress);
|
|
});
|
|
xhr.addEventListener("load", onLoad);
|
|
xhr.addEventListener("error", onError);
|
|
xhr.addEventListener("timeout", onTimeout);
|
|
xhr.addEventListener("abort", onError);
|
|
if (req.reportProgress) {
|
|
xhr.addEventListener("progress", onDownProgress);
|
|
if (reqBody !== null && xhr.upload) {
|
|
xhr.upload.addEventListener("progress", onUpProgress);
|
|
}
|
|
}
|
|
xhr.send(reqBody);
|
|
observer.next({
|
|
type: HttpEventType.Sent
|
|
});
|
|
return () => {
|
|
xhr.removeEventListener("error", onError);
|
|
xhr.removeEventListener("abort", onError);
|
|
xhr.removeEventListener("load", onLoad);
|
|
xhr.removeEventListener("timeout", onTimeout);
|
|
if (req.reportProgress) {
|
|
xhr.removeEventListener("progress", onDownProgress);
|
|
if (reqBody !== null && xhr.upload) {
|
|
xhr.upload.removeEventListener("progress", onUpProgress);
|
|
}
|
|
}
|
|
if (xhr.readyState !== xhr.DONE) {
|
|
xhr.abort();
|
|
}
|
|
};
|
|
});
|
|
}));
|
|
}
|
|
static ɵfac = function HttpXhrBackend_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpXhrBackend)(ɵɵinject(XhrFactory));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpXhrBackend,
|
|
factory: _HttpXhrBackend.ɵfac,
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXhrBackend, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root"
|
|
}]
|
|
}], () => [{
|
|
type: XhrFactory
|
|
}], null);
|
|
})();
|
|
function interceptorChainEndFn(req, finalHandlerFn) {
|
|
return finalHandlerFn(req);
|
|
}
|
|
function adaptLegacyInterceptorToChain(chainTailFn, interceptor) {
|
|
return (initialRequest, finalHandlerFn) => interceptor.intercept(initialRequest, {
|
|
handle: (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)
|
|
});
|
|
}
|
|
function chainedInterceptorFn(chainTailFn, interceptorFn, injector) {
|
|
return (initialRequest, finalHandlerFn) => runInInjectionContext(injector, () => interceptorFn(initialRequest, (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)));
|
|
}
|
|
var HTTP_INTERCEPTORS = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "HTTP_INTERCEPTORS" : "");
|
|
var HTTP_INTERCEPTOR_FNS = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "HTTP_INTERCEPTOR_FNS" : "", {
|
|
factory: () => []
|
|
});
|
|
var HTTP_ROOT_INTERCEPTOR_FNS = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "HTTP_ROOT_INTERCEPTOR_FNS" : "");
|
|
var REQUESTS_CONTRIBUTE_TO_STABILITY = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "REQUESTS_CONTRIBUTE_TO_STABILITY" : "", {
|
|
factory: () => true
|
|
});
|
|
function legacyInterceptorFnFactory() {
|
|
let chain = null;
|
|
return (req, handler) => {
|
|
if (chain === null) {
|
|
const interceptors = inject(HTTP_INTERCEPTORS, {
|
|
optional: true
|
|
}) ?? [];
|
|
chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);
|
|
}
|
|
const pendingTasks = inject(PendingTasks);
|
|
const contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);
|
|
if (contributeToStability) {
|
|
const removeTask = pendingTasks.add();
|
|
return chain(req, handler).pipe(finalize(removeTask));
|
|
} else {
|
|
return chain(req, handler);
|
|
}
|
|
};
|
|
}
|
|
var HttpBackend = class _HttpBackend {
|
|
static ɵfac = function HttpBackend_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpBackend)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpBackend,
|
|
factory: function HttpBackend_Factory(__ngFactoryType__) {
|
|
let __ngConditionalFactory__ = null;
|
|
if (__ngFactoryType__) {
|
|
__ngConditionalFactory__ = new (__ngFactoryType__ || _HttpBackend)();
|
|
} else {
|
|
__ngConditionalFactory__ = ɵɵinject(HttpXhrBackend);
|
|
}
|
|
return __ngConditionalFactory__;
|
|
},
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpBackend, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root",
|
|
useExisting: HttpXhrBackend
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
var fetchBackendWarningDisplayed = false;
|
|
var HttpInterceptorHandler = class _HttpInterceptorHandler {
|
|
backend;
|
|
injector;
|
|
chain = null;
|
|
pendingTasks = inject(PendingTasks);
|
|
contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);
|
|
constructor(backend, injector) {
|
|
this.backend = backend;
|
|
this.injector = injector;
|
|
if ((typeof ngDevMode === "undefined" || ngDevMode) && !fetchBackendWarningDisplayed) {
|
|
const isTestingBackend = this.backend.isTestingBackend;
|
|
if (false) {
|
|
fetchBackendWarningDisplayed = true;
|
|
injector.get(Console).warn(formatRuntimeError(2801, "Angular detected that `HttpClient` is not configured to use `fetch` APIs. It's strongly recommended to enable `fetch` for applications that use Server-Side Rendering for better performance and compatibility. To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` call at the root of the application."));
|
|
}
|
|
}
|
|
}
|
|
handle(initialRequest) {
|
|
if (this.chain === null) {
|
|
const dedupedInterceptorFns = Array.from(/* @__PURE__ */ new Set([...this.injector.get(HTTP_INTERCEPTOR_FNS), ...this.injector.get(HTTP_ROOT_INTERCEPTOR_FNS, [])]));
|
|
this.chain = dedupedInterceptorFns.reduceRight((nextSequencedFn, interceptorFn) => chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector), interceptorChainEndFn);
|
|
}
|
|
if (this.contributeToStability) {
|
|
const removeTask = this.pendingTasks.add();
|
|
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest)).pipe(finalize(removeTask));
|
|
} else {
|
|
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));
|
|
}
|
|
}
|
|
static ɵfac = function HttpInterceptorHandler_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpInterceptorHandler)(ɵɵinject(HttpBackend), ɵɵinject(EnvironmentInjector));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpInterceptorHandler,
|
|
factory: _HttpInterceptorHandler.ɵfac,
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpInterceptorHandler, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root"
|
|
}]
|
|
}], () => [{
|
|
type: HttpBackend
|
|
}, {
|
|
type: EnvironmentInjector
|
|
}], null);
|
|
})();
|
|
var HttpHandler = class _HttpHandler {
|
|
static ɵfac = function HttpHandler_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpHandler)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpHandler,
|
|
factory: function HttpHandler_Factory(__ngFactoryType__) {
|
|
let __ngConditionalFactory__ = null;
|
|
if (__ngFactoryType__) {
|
|
__ngConditionalFactory__ = new (__ngFactoryType__ || _HttpHandler)();
|
|
} else {
|
|
__ngConditionalFactory__ = ɵɵinject(HttpInterceptorHandler);
|
|
}
|
|
return __ngConditionalFactory__;
|
|
},
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpHandler, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root",
|
|
useExisting: HttpInterceptorHandler
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
function addBody(options, body) {
|
|
return {
|
|
body,
|
|
headers: options.headers,
|
|
context: options.context,
|
|
observe: options.observe,
|
|
params: options.params,
|
|
reportProgress: options.reportProgress,
|
|
responseType: options.responseType,
|
|
withCredentials: options.withCredentials,
|
|
credentials: options.credentials,
|
|
transferCache: options.transferCache,
|
|
timeout: options.timeout,
|
|
keepalive: options.keepalive,
|
|
priority: options.priority,
|
|
cache: options.cache,
|
|
mode: options.mode,
|
|
redirect: options.redirect,
|
|
integrity: options.integrity,
|
|
referrer: options.referrer,
|
|
referrerPolicy: options.referrerPolicy
|
|
};
|
|
}
|
|
var HttpClient = class _HttpClient {
|
|
handler;
|
|
constructor(handler) {
|
|
this.handler = handler;
|
|
}
|
|
request(first, url, options = {}) {
|
|
let req;
|
|
if (first instanceof HttpRequest) {
|
|
req = first;
|
|
} else {
|
|
let headers = void 0;
|
|
if (options.headers instanceof HttpHeaders) {
|
|
headers = options.headers;
|
|
} else {
|
|
headers = new HttpHeaders(options.headers);
|
|
}
|
|
let params = void 0;
|
|
if (!!options.params) {
|
|
if (options.params instanceof HttpParams) {
|
|
params = options.params;
|
|
} else {
|
|
params = new HttpParams({
|
|
fromObject: options.params
|
|
});
|
|
}
|
|
}
|
|
req = new HttpRequest(first, url, options.body !== void 0 ? options.body : null, {
|
|
headers,
|
|
context: options.context,
|
|
params,
|
|
reportProgress: options.reportProgress,
|
|
responseType: options.responseType || "json",
|
|
withCredentials: options.withCredentials,
|
|
transferCache: options.transferCache,
|
|
keepalive: options.keepalive,
|
|
priority: options.priority,
|
|
cache: options.cache,
|
|
mode: options.mode,
|
|
redirect: options.redirect,
|
|
credentials: options.credentials,
|
|
referrer: options.referrer,
|
|
referrerPolicy: options.referrerPolicy,
|
|
integrity: options.integrity,
|
|
timeout: options.timeout
|
|
});
|
|
}
|
|
const events$ = of(req).pipe(concatMap((req2) => this.handler.handle(req2)));
|
|
if (first instanceof HttpRequest || options.observe === "events") {
|
|
return events$;
|
|
}
|
|
const res$ = events$.pipe(filter((event) => event instanceof HttpResponse));
|
|
switch (options.observe || "body") {
|
|
case "body":
|
|
switch (req.responseType) {
|
|
case "arraybuffer":
|
|
return res$.pipe(map((res) => {
|
|
if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
|
|
throw new RuntimeError(2806, ngDevMode && "Response is not an ArrayBuffer.");
|
|
}
|
|
return res.body;
|
|
}));
|
|
case "blob":
|
|
return res$.pipe(map((res) => {
|
|
if (res.body !== null && !(res.body instanceof Blob)) {
|
|
throw new RuntimeError(2807, ngDevMode && "Response is not a Blob.");
|
|
}
|
|
return res.body;
|
|
}));
|
|
case "text":
|
|
return res$.pipe(map((res) => {
|
|
if (res.body !== null && typeof res.body !== "string") {
|
|
throw new RuntimeError(2808, ngDevMode && "Response is not a string.");
|
|
}
|
|
return res.body;
|
|
}));
|
|
case "json":
|
|
default:
|
|
return res$.pipe(map((res) => res.body));
|
|
}
|
|
case "response":
|
|
return res$;
|
|
default:
|
|
throw new RuntimeError(2809, ngDevMode && `Unreachable: unhandled observe type ${options.observe}}`);
|
|
}
|
|
}
|
|
delete(url, options = {}) {
|
|
return this.request("DELETE", url, options);
|
|
}
|
|
get(url, options = {}) {
|
|
return this.request("GET", url, options);
|
|
}
|
|
head(url, options = {}) {
|
|
return this.request("HEAD", url, options);
|
|
}
|
|
jsonp(url, callbackParam) {
|
|
return this.request("JSONP", url, {
|
|
params: new HttpParams().append(callbackParam, "JSONP_CALLBACK"),
|
|
observe: "body",
|
|
responseType: "json"
|
|
});
|
|
}
|
|
options(url, options = {}) {
|
|
return this.request("OPTIONS", url, options);
|
|
}
|
|
patch(url, body, options = {}) {
|
|
return this.request("PATCH", url, addBody(options, body));
|
|
}
|
|
post(url, body, options = {}) {
|
|
return this.request("POST", url, addBody(options, body));
|
|
}
|
|
put(url, body, options = {}) {
|
|
return this.request("PUT", url, addBody(options, body));
|
|
}
|
|
static ɵfac = function HttpClient_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpClient)(ɵɵinject(HttpHandler));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpClient,
|
|
factory: _HttpClient.ɵfac,
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClient, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root"
|
|
}]
|
|
}], () => [{
|
|
type: HttpHandler
|
|
}], null);
|
|
})();
|
|
var nextRequestId = 0;
|
|
var foreignDocument;
|
|
var JSONP_ERR_NO_CALLBACK = "JSONP injected script did not invoke callback.";
|
|
var JSONP_ERR_WRONG_METHOD = "JSONP requests must use JSONP request method.";
|
|
var JSONP_ERR_WRONG_RESPONSE_TYPE = "JSONP requests must use Json response type.";
|
|
var JSONP_ERR_HEADERS_NOT_SUPPORTED = "JSONP requests do not support headers.";
|
|
var JsonpCallbackContext = class {
|
|
};
|
|
function jsonpCallbackContext() {
|
|
if (typeof window === "object") {
|
|
return window;
|
|
}
|
|
return {};
|
|
}
|
|
var JsonpClientBackend = class _JsonpClientBackend {
|
|
callbackMap;
|
|
document;
|
|
resolvedPromise = Promise.resolve();
|
|
constructor(callbackMap, document2) {
|
|
this.callbackMap = callbackMap;
|
|
this.document = document2;
|
|
}
|
|
nextCallback() {
|
|
return `ng_jsonp_callback_${nextRequestId++}`;
|
|
}
|
|
handle(req) {
|
|
if (req.method !== "JSONP") {
|
|
throw new RuntimeError(2810, ngDevMode && JSONP_ERR_WRONG_METHOD);
|
|
} else if (req.responseType !== "json") {
|
|
throw new RuntimeError(2811, ngDevMode && JSONP_ERR_WRONG_RESPONSE_TYPE);
|
|
}
|
|
if (req.headers.keys().length > 0) {
|
|
throw new RuntimeError(2812, ngDevMode && JSONP_ERR_HEADERS_NOT_SUPPORTED);
|
|
}
|
|
return new Observable((observer) => {
|
|
const callback = this.nextCallback();
|
|
const url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`);
|
|
const node = this.document.createElement("script");
|
|
node.src = url;
|
|
let body = null;
|
|
let finished = false;
|
|
this.callbackMap[callback] = (data) => {
|
|
delete this.callbackMap[callback];
|
|
body = data;
|
|
finished = true;
|
|
};
|
|
const cleanup = () => {
|
|
node.removeEventListener("load", onLoad);
|
|
node.removeEventListener("error", onError);
|
|
node.remove();
|
|
delete this.callbackMap[callback];
|
|
};
|
|
const onLoad = () => {
|
|
this.resolvedPromise.then(() => {
|
|
cleanup();
|
|
if (!finished) {
|
|
observer.error(new HttpErrorResponse({
|
|
url,
|
|
status: 0,
|
|
statusText: "JSONP Error",
|
|
error: new Error(JSONP_ERR_NO_CALLBACK)
|
|
}));
|
|
return;
|
|
}
|
|
observer.next(new HttpResponse({
|
|
body,
|
|
status: HTTP_STATUS_CODE_OK,
|
|
statusText: "OK",
|
|
url
|
|
}));
|
|
observer.complete();
|
|
});
|
|
};
|
|
const onError = (error) => {
|
|
cleanup();
|
|
observer.error(new HttpErrorResponse({
|
|
error,
|
|
status: 0,
|
|
statusText: "JSONP Error",
|
|
url
|
|
}));
|
|
};
|
|
node.addEventListener("load", onLoad);
|
|
node.addEventListener("error", onError);
|
|
this.document.body.appendChild(node);
|
|
observer.next({
|
|
type: HttpEventType.Sent
|
|
});
|
|
return () => {
|
|
if (!finished) {
|
|
this.removeListeners(node);
|
|
}
|
|
cleanup();
|
|
};
|
|
});
|
|
}
|
|
removeListeners(script) {
|
|
foreignDocument ??= this.document.implementation.createHTMLDocument();
|
|
foreignDocument.adoptNode(script);
|
|
}
|
|
static ɵfac = function JsonpClientBackend_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _JsonpClientBackend)(ɵɵinject(JsonpCallbackContext), ɵɵinject(DOCUMENT));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _JsonpClientBackend,
|
|
factory: _JsonpClientBackend.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpClientBackend, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: JsonpCallbackContext
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}], null);
|
|
})();
|
|
function jsonpInterceptorFn(req, next) {
|
|
if (req.method === "JSONP") {
|
|
return inject(JsonpClientBackend).handle(req);
|
|
}
|
|
return next(req);
|
|
}
|
|
var JsonpInterceptor = class _JsonpInterceptor {
|
|
injector;
|
|
constructor(injector) {
|
|
this.injector = injector;
|
|
}
|
|
intercept(initialRequest, next) {
|
|
return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
}
|
|
static ɵfac = function JsonpInterceptor_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _JsonpInterceptor)(ɵɵinject(EnvironmentInjector));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _JsonpInterceptor,
|
|
factory: _JsonpInterceptor.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpInterceptor, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: EnvironmentInjector
|
|
}], null);
|
|
})();
|
|
var XSRF_ENABLED = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "XSRF_ENABLED" : "", {
|
|
factory: () => true
|
|
});
|
|
var XSRF_DEFAULT_COOKIE_NAME = "XSRF-TOKEN";
|
|
var XSRF_COOKIE_NAME = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "XSRF_COOKIE_NAME" : "", {
|
|
factory: () => XSRF_DEFAULT_COOKIE_NAME
|
|
});
|
|
var XSRF_DEFAULT_HEADER_NAME = "X-XSRF-TOKEN";
|
|
var XSRF_HEADER_NAME = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "XSRF_HEADER_NAME" : "", {
|
|
factory: () => XSRF_DEFAULT_HEADER_NAME
|
|
});
|
|
var HttpXsrfCookieExtractor = class _HttpXsrfCookieExtractor {
|
|
cookieName = inject(XSRF_COOKIE_NAME);
|
|
doc = inject(DOCUMENT);
|
|
lastCookieString = "";
|
|
lastToken = null;
|
|
parseCount = 0;
|
|
getToken() {
|
|
if (false) {
|
|
return null;
|
|
}
|
|
const cookieString = this.doc.cookie || "";
|
|
if (cookieString !== this.lastCookieString) {
|
|
this.parseCount++;
|
|
this.lastToken = parseCookieValue(cookieString, this.cookieName);
|
|
this.lastCookieString = cookieString;
|
|
}
|
|
return this.lastToken;
|
|
}
|
|
static ɵfac = function HttpXsrfCookieExtractor_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpXsrfCookieExtractor)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpXsrfCookieExtractor,
|
|
factory: _HttpXsrfCookieExtractor.ɵfac,
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfCookieExtractor, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root"
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
var HttpXsrfTokenExtractor = class _HttpXsrfTokenExtractor {
|
|
static ɵfac = function HttpXsrfTokenExtractor_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpXsrfTokenExtractor)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpXsrfTokenExtractor,
|
|
factory: function HttpXsrfTokenExtractor_Factory(__ngFactoryType__) {
|
|
let __ngConditionalFactory__ = null;
|
|
if (__ngFactoryType__) {
|
|
__ngConditionalFactory__ = new (__ngFactoryType__ || _HttpXsrfTokenExtractor)();
|
|
} else {
|
|
__ngConditionalFactory__ = ɵɵinject(HttpXsrfCookieExtractor);
|
|
}
|
|
return __ngConditionalFactory__;
|
|
},
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfTokenExtractor, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root",
|
|
useExisting: HttpXsrfCookieExtractor
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
function xsrfInterceptorFn(req, next) {
|
|
if (!inject(XSRF_ENABLED) || req.method === "GET" || req.method === "HEAD") {
|
|
return next(req);
|
|
}
|
|
try {
|
|
const locationHref = inject(PlatformLocation).href;
|
|
const {
|
|
origin: locationOrigin
|
|
} = new URL(locationHref);
|
|
const {
|
|
origin: requestOrigin
|
|
} = new URL(req.url, locationOrigin);
|
|
if (locationOrigin !== requestOrigin) {
|
|
return next(req);
|
|
}
|
|
} catch {
|
|
return next(req);
|
|
}
|
|
const token = inject(HttpXsrfTokenExtractor).getToken();
|
|
const headerName = inject(XSRF_HEADER_NAME);
|
|
if (token != null && !req.headers.has(headerName)) {
|
|
req = req.clone({
|
|
headers: req.headers.set(headerName, token)
|
|
});
|
|
}
|
|
return next(req);
|
|
}
|
|
var HttpXsrfInterceptor = class _HttpXsrfInterceptor {
|
|
injector = inject(EnvironmentInjector);
|
|
intercept(initialRequest, next) {
|
|
return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
}
|
|
static ɵfac = function HttpXsrfInterceptor_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpXsrfInterceptor)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HttpXsrfInterceptor,
|
|
factory: _HttpXsrfInterceptor.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfInterceptor, [{
|
|
type: Injectable
|
|
}], null, null);
|
|
})();
|
|
var HttpFeatureKind;
|
|
(function(HttpFeatureKind2) {
|
|
HttpFeatureKind2[HttpFeatureKind2["Interceptors"] = 0] = "Interceptors";
|
|
HttpFeatureKind2[HttpFeatureKind2["LegacyInterceptors"] = 1] = "LegacyInterceptors";
|
|
HttpFeatureKind2[HttpFeatureKind2["CustomXsrfConfiguration"] = 2] = "CustomXsrfConfiguration";
|
|
HttpFeatureKind2[HttpFeatureKind2["NoXsrfProtection"] = 3] = "NoXsrfProtection";
|
|
HttpFeatureKind2[HttpFeatureKind2["JsonpSupport"] = 4] = "JsonpSupport";
|
|
HttpFeatureKind2[HttpFeatureKind2["RequestsMadeViaParent"] = 5] = "RequestsMadeViaParent";
|
|
HttpFeatureKind2[HttpFeatureKind2["Fetch"] = 6] = "Fetch";
|
|
})(HttpFeatureKind || (HttpFeatureKind = {}));
|
|
function makeHttpFeature(kind, providers) {
|
|
return {
|
|
ɵkind: kind,
|
|
ɵproviders: providers
|
|
};
|
|
}
|
|
function provideHttpClient(...features) {
|
|
if (ngDevMode) {
|
|
const featureKinds = new Set(features.map((f) => f.ɵkind));
|
|
if (featureKinds.has(HttpFeatureKind.NoXsrfProtection) && featureKinds.has(HttpFeatureKind.CustomXsrfConfiguration)) {
|
|
throw new Error(ngDevMode ? `Configuration error: found both withXsrfConfiguration() and withNoXsrfProtection() in the same call to provideHttpClient(), which is a contradiction.` : "");
|
|
}
|
|
}
|
|
const providers = [HttpClient, HttpInterceptorHandler, {
|
|
provide: HttpHandler,
|
|
useExisting: HttpInterceptorHandler
|
|
}, {
|
|
provide: HttpBackend,
|
|
useFactory: () => {
|
|
return inject(FETCH_BACKEND, {
|
|
optional: true
|
|
}) ?? inject(HttpXhrBackend);
|
|
}
|
|
}, {
|
|
provide: HTTP_INTERCEPTOR_FNS,
|
|
useValue: xsrfInterceptorFn,
|
|
multi: true
|
|
}];
|
|
for (const feature of features) {
|
|
providers.push(...feature.ɵproviders);
|
|
}
|
|
return makeEnvironmentProviders(providers);
|
|
}
|
|
var LEGACY_INTERCEPTOR_FN = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "LEGACY_INTERCEPTOR_FN" : "");
|
|
function withInterceptorsFromDi() {
|
|
return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [{
|
|
provide: LEGACY_INTERCEPTOR_FN,
|
|
useFactory: legacyInterceptorFnFactory
|
|
}, {
|
|
provide: HTTP_INTERCEPTOR_FNS,
|
|
useExisting: LEGACY_INTERCEPTOR_FN,
|
|
multi: true
|
|
}]);
|
|
}
|
|
function withXsrfConfiguration({
|
|
cookieName,
|
|
headerName
|
|
}) {
|
|
const providers = [];
|
|
if (cookieName !== void 0) {
|
|
providers.push({
|
|
provide: XSRF_COOKIE_NAME,
|
|
useValue: cookieName
|
|
});
|
|
}
|
|
if (headerName !== void 0) {
|
|
providers.push({
|
|
provide: XSRF_HEADER_NAME,
|
|
useValue: headerName
|
|
});
|
|
}
|
|
return makeHttpFeature(HttpFeatureKind.CustomXsrfConfiguration, providers);
|
|
}
|
|
function withNoXsrfProtection() {
|
|
return makeHttpFeature(HttpFeatureKind.NoXsrfProtection, [{
|
|
provide: XSRF_ENABLED,
|
|
useValue: false
|
|
}]);
|
|
}
|
|
function withJsonpSupport() {
|
|
return makeHttpFeature(HttpFeatureKind.JsonpSupport, [JsonpClientBackend, {
|
|
provide: JsonpCallbackContext,
|
|
useFactory: jsonpCallbackContext
|
|
}, {
|
|
provide: HTTP_INTERCEPTOR_FNS,
|
|
useValue: jsonpInterceptorFn,
|
|
multi: true
|
|
}]);
|
|
}
|
|
var HttpClientXsrfModule = class _HttpClientXsrfModule {
|
|
static disable() {
|
|
return {
|
|
ngModule: _HttpClientXsrfModule,
|
|
providers: [withNoXsrfProtection().ɵproviders]
|
|
};
|
|
}
|
|
static withOptions(options = {}) {
|
|
return {
|
|
ngModule: _HttpClientXsrfModule,
|
|
providers: withXsrfConfiguration(options).ɵproviders
|
|
};
|
|
}
|
|
static ɵfac = function HttpClientXsrfModule_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpClientXsrfModule)();
|
|
};
|
|
static ɵmod = ɵɵdefineNgModule({
|
|
type: _HttpClientXsrfModule
|
|
});
|
|
static ɵinj = ɵɵdefineInjector({
|
|
providers: [HttpXsrfInterceptor, {
|
|
provide: HTTP_INTERCEPTORS,
|
|
useExisting: HttpXsrfInterceptor,
|
|
multi: true
|
|
}, {
|
|
provide: HttpXsrfTokenExtractor,
|
|
useClass: HttpXsrfCookieExtractor
|
|
}, withXsrfConfiguration({
|
|
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
headerName: XSRF_DEFAULT_HEADER_NAME
|
|
}).ɵproviders, {
|
|
provide: XSRF_ENABLED,
|
|
useValue: true
|
|
}]
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientXsrfModule, [{
|
|
type: NgModule,
|
|
args: [{
|
|
providers: [HttpXsrfInterceptor, {
|
|
provide: HTTP_INTERCEPTORS,
|
|
useExisting: HttpXsrfInterceptor,
|
|
multi: true
|
|
}, {
|
|
provide: HttpXsrfTokenExtractor,
|
|
useClass: HttpXsrfCookieExtractor
|
|
}, withXsrfConfiguration({
|
|
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
headerName: XSRF_DEFAULT_HEADER_NAME
|
|
}).ɵproviders, {
|
|
provide: XSRF_ENABLED,
|
|
useValue: true
|
|
}]
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
var HttpClientModule = class _HttpClientModule {
|
|
static ɵfac = function HttpClientModule_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpClientModule)();
|
|
};
|
|
static ɵmod = ɵɵdefineNgModule({
|
|
type: _HttpClientModule
|
|
});
|
|
static ɵinj = ɵɵdefineInjector({
|
|
providers: [provideHttpClient(withInterceptorsFromDi())]
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientModule, [{
|
|
type: NgModule,
|
|
args: [{
|
|
providers: [provideHttpClient(withInterceptorsFromDi())]
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
var HttpClientJsonpModule = class _HttpClientJsonpModule {
|
|
static ɵfac = function HttpClientJsonpModule_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HttpClientJsonpModule)();
|
|
};
|
|
static ɵmod = ɵɵdefineNgModule({
|
|
type: _HttpClientJsonpModule
|
|
});
|
|
static ɵinj = ɵɵdefineInjector({
|
|
providers: [withJsonpSupport().ɵproviders]
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientJsonpModule, [{
|
|
type: NgModule,
|
|
args: [{
|
|
providers: [withJsonpSupport().ɵproviders]
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
|
|
// node_modules/@angular/common/fesm2022/http.mjs
|
|
var HTTP_TRANSFER_CACHE_ORIGIN_MAP = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "HTTP_TRANSFER_CACHE_ORIGIN_MAP" : "");
|
|
var BODY = "b";
|
|
var HEADERS = "h";
|
|
var STATUS = "s";
|
|
var STATUS_TEXT = "st";
|
|
var REQ_URL = "u";
|
|
var RESPONSE_TYPE = "rt";
|
|
var CACHE_OPTIONS = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "HTTP_TRANSFER_STATE_CACHE_OPTIONS" : "");
|
|
var ALLOWED_METHODS = ["GET", "HEAD"];
|
|
function shouldCacheRequest(req, options) {
|
|
const _a = options, {
|
|
isCacheActive
|
|
} = _a, globalOptions = __objRest(_a, [
|
|
"isCacheActive"
|
|
]);
|
|
const {
|
|
transferCache: requestOptions,
|
|
method: requestMethod
|
|
} = req;
|
|
if (!isCacheActive || requestOptions === false || requestMethod === "POST" && !globalOptions.includePostRequests && !requestOptions || requestMethod !== "POST" && !ALLOWED_METHODS.includes(requestMethod) || !globalOptions.includeRequestsWithAuthHeaders && hasAuthHeaders(req) || globalOptions.filter?.(req) === false) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function getHeadersToInclude(options, requestOptions) {
|
|
const {
|
|
includeHeaders: globalHeaders
|
|
} = options;
|
|
let headersToInclude = globalHeaders;
|
|
if (typeof requestOptions === "object" && requestOptions.includeHeaders) {
|
|
headersToInclude = requestOptions.includeHeaders;
|
|
}
|
|
return headersToInclude;
|
|
}
|
|
function retrieveStateFromCache(req, options, transferState, originMap) {
|
|
const {
|
|
transferCache: requestOptions
|
|
} = req;
|
|
if (!shouldCacheRequest(req, options)) {
|
|
return null;
|
|
}
|
|
if (originMap) {
|
|
throw new RuntimeError(2803, ngDevMode && "Angular detected that the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token is configured and present in the client side code. Please ensure that this token is only provided in the server code of the application.");
|
|
}
|
|
const requestUrl = false ? mapRequestOriginUrl(req.url, originMap) : req.url;
|
|
const storeKey = makeCacheKey(req, requestUrl);
|
|
const response = transferState.get(storeKey, null);
|
|
const headersToInclude = getHeadersToInclude(options, requestOptions);
|
|
if (response) {
|
|
const {
|
|
[BODY]: undecodedBody,
|
|
[RESPONSE_TYPE]: responseType,
|
|
[HEADERS]: httpHeaders,
|
|
[STATUS]: status,
|
|
[STATUS_TEXT]: statusText,
|
|
[REQ_URL]: url
|
|
} = response;
|
|
let body = undecodedBody;
|
|
switch (responseType) {
|
|
case "arraybuffer":
|
|
body = fromBase64(undecodedBody);
|
|
break;
|
|
case "blob":
|
|
body = new Blob([fromBase64(undecodedBody)]);
|
|
break;
|
|
}
|
|
let headers = new HttpHeaders(httpHeaders);
|
|
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
headers = appendMissingHeadersDetection(req.url, headers, headersToInclude ?? []);
|
|
}
|
|
return new HttpResponse({
|
|
body,
|
|
headers,
|
|
status,
|
|
statusText,
|
|
url
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
function transferCacheInterceptorFn(req, next) {
|
|
const options = inject(CACHE_OPTIONS);
|
|
const transferState = inject(TransferState);
|
|
const originMap = inject(HTTP_TRANSFER_CACHE_ORIGIN_MAP, {
|
|
optional: true
|
|
});
|
|
const cachedResponse = retrieveStateFromCache(req, options, transferState, originMap);
|
|
if (cachedResponse) {
|
|
return of(cachedResponse);
|
|
}
|
|
const {
|
|
transferCache: requestOptions
|
|
} = req;
|
|
const headersToInclude = getHeadersToInclude(options, requestOptions);
|
|
const requestUrl = false ? mapRequestOriginUrl(req.url, originMap) : req.url;
|
|
const storeKey = makeCacheKey(req, requestUrl);
|
|
if (!shouldCacheRequest(req, options)) {
|
|
return next(req);
|
|
}
|
|
const event$ = next(req);
|
|
if (false) {
|
|
return event$.pipe(tap((event) => {
|
|
if (event instanceof HttpResponse) {
|
|
transferState.set(storeKey, {
|
|
[BODY]: req.responseType === "arraybuffer" || req.responseType === "blob" ? toBase64(event.body) : event.body,
|
|
[HEADERS]: getFilteredHeaders(event.headers, headersToInclude),
|
|
[STATUS]: event.status,
|
|
[STATUS_TEXT]: event.statusText,
|
|
[REQ_URL]: requestUrl,
|
|
[RESPONSE_TYPE]: req.responseType
|
|
});
|
|
}
|
|
}));
|
|
}
|
|
return event$;
|
|
}
|
|
function hasAuthHeaders(req) {
|
|
return req.headers.has("authorization") || req.headers.has("proxy-authorization");
|
|
}
|
|
function sortAndConcatParams(params) {
|
|
return [...params.keys()].sort().map((k) => `${k}=${params.getAll(k)}`).join("&");
|
|
}
|
|
function makeCacheKey(request, mappedRequestUrl) {
|
|
const {
|
|
params,
|
|
method,
|
|
responseType
|
|
} = request;
|
|
const encodedParams = sortAndConcatParams(params);
|
|
let serializedBody = request.serializeBody();
|
|
if (serializedBody instanceof URLSearchParams) {
|
|
serializedBody = sortAndConcatParams(serializedBody);
|
|
} else if (typeof serializedBody !== "string") {
|
|
serializedBody = "";
|
|
}
|
|
const key = [method, responseType, mappedRequestUrl, serializedBody, encodedParams].join("|");
|
|
const hash = generateHash(key);
|
|
return makeStateKey(hash);
|
|
}
|
|
function generateHash(value) {
|
|
let hash = 0;
|
|
for (const char of value) {
|
|
hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;
|
|
}
|
|
hash += 2147483647 + 1;
|
|
return hash.toString();
|
|
}
|
|
function fromBase64(base64) {
|
|
const binary = atob(base64);
|
|
const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
return bytes.buffer;
|
|
}
|
|
function withHttpTransferCache(cacheOptions) {
|
|
return [{
|
|
provide: CACHE_OPTIONS,
|
|
useFactory: () => {
|
|
performanceMarkFeature("NgHttpTransferCache");
|
|
return __spreadValues({
|
|
isCacheActive: true
|
|
}, cacheOptions);
|
|
}
|
|
}, {
|
|
provide: HTTP_ROOT_INTERCEPTOR_FNS,
|
|
useValue: transferCacheInterceptorFn,
|
|
multi: true
|
|
}, {
|
|
provide: APP_BOOTSTRAP_LISTENER,
|
|
multi: true,
|
|
useFactory: () => {
|
|
const appRef = inject(ApplicationRef);
|
|
const cacheState = inject(CACHE_OPTIONS);
|
|
return () => {
|
|
appRef.whenStable().then(() => {
|
|
cacheState.isCacheActive = false;
|
|
});
|
|
};
|
|
}
|
|
}];
|
|
}
|
|
function appendMissingHeadersDetection(url, headers, headersToInclude) {
|
|
const warningProduced = /* @__PURE__ */ new Set();
|
|
return new Proxy(headers, {
|
|
get(target, prop) {
|
|
const value = Reflect.get(target, prop);
|
|
const methods = /* @__PURE__ */ new Set(["get", "has", "getAll"]);
|
|
if (typeof value !== "function" || !methods.has(prop)) {
|
|
return value;
|
|
}
|
|
return (headerName) => {
|
|
const key = (prop + ":" + headerName).toLowerCase();
|
|
if (!headersToInclude.includes(headerName) && !warningProduced.has(key)) {
|
|
warningProduced.add(key);
|
|
const truncatedUrl = truncateMiddle(url);
|
|
console.warn(formatRuntimeError(-2802, `Angular detected that the \`${headerName}\` header is accessed, but the value of the header was not transferred from the server to the client by the HttpTransferCache. To include the value of the \`${headerName}\` header for the \`${truncatedUrl}\` request, use the \`includeHeaders\` list. The \`includeHeaders\` can be defined either on a request level by adding the \`transferCache\` parameter, or on an application level by adding the \`httpCacheTransfer.includeHeaders\` argument to the \`provideClientHydration()\` call. `));
|
|
}
|
|
return value.apply(target, [headerName]);
|
|
};
|
|
}
|
|
});
|
|
}
|
|
var httpResource = (() => {
|
|
const jsonFn = makeHttpResourceFn("json");
|
|
jsonFn.arrayBuffer = makeHttpResourceFn("arraybuffer");
|
|
jsonFn.blob = makeHttpResourceFn("blob");
|
|
jsonFn.text = makeHttpResourceFn("text");
|
|
return jsonFn;
|
|
})();
|
|
function makeHttpResourceFn(responseType) {
|
|
return function httpResource2(request, options) {
|
|
if (ngDevMode && !options?.injector) {
|
|
assertInInjectionContext(httpResource2);
|
|
}
|
|
const injector = options?.injector ?? inject(Injector);
|
|
const cacheOptions = injector.get(CACHE_OPTIONS, null, {
|
|
optional: true
|
|
});
|
|
const transferState = injector.get(TransferState, null, {
|
|
optional: true
|
|
});
|
|
const originMap = injector.get(HTTP_TRANSFER_CACHE_ORIGIN_MAP, null, {
|
|
optional: true
|
|
});
|
|
const getInitialStream = (req) => {
|
|
if (cacheOptions && transferState && req) {
|
|
const cachedResponse = retrieveStateFromCache(req, cacheOptions, transferState, originMap);
|
|
if (cachedResponse) {
|
|
try {
|
|
const body = cachedResponse.body;
|
|
const parsed = options?.parse ? options.parse(body) : body;
|
|
return signal({
|
|
value: parsed
|
|
});
|
|
} catch (e) {
|
|
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
console.warn(`Angular detected an error while parsing the cached response for the httpResource at \`${req.url}\`. The resource will fall back to its default value and try again asynchronously.`, e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return void 0;
|
|
};
|
|
return new HttpResourceImpl(injector, () => normalizeRequest(request, responseType), options?.defaultValue, options?.debugName, options?.parse, options?.equal, getInitialStream);
|
|
};
|
|
}
|
|
function normalizeRequest(request, responseType) {
|
|
let unwrappedRequest = typeof request === "function" ? request() : request;
|
|
if (unwrappedRequest === void 0) {
|
|
return void 0;
|
|
} else if (typeof unwrappedRequest === "string") {
|
|
unwrappedRequest = {
|
|
url: unwrappedRequest
|
|
};
|
|
}
|
|
const headers = unwrappedRequest.headers instanceof HttpHeaders ? unwrappedRequest.headers : new HttpHeaders(unwrappedRequest.headers);
|
|
const params = unwrappedRequest.params instanceof HttpParams ? unwrappedRequest.params : new HttpParams({
|
|
fromObject: unwrappedRequest.params
|
|
});
|
|
return new HttpRequest(unwrappedRequest.method ?? "GET", unwrappedRequest.url, unwrappedRequest.body ?? null, {
|
|
headers,
|
|
params,
|
|
reportProgress: unwrappedRequest.reportProgress,
|
|
withCredentials: unwrappedRequest.withCredentials,
|
|
keepalive: unwrappedRequest.keepalive,
|
|
cache: unwrappedRequest.cache,
|
|
priority: unwrappedRequest.priority,
|
|
mode: unwrappedRequest.mode,
|
|
redirect: unwrappedRequest.redirect,
|
|
responseType,
|
|
context: unwrappedRequest.context,
|
|
transferCache: unwrappedRequest.transferCache,
|
|
credentials: unwrappedRequest.credentials,
|
|
referrer: unwrappedRequest.referrer,
|
|
referrerPolicy: unwrappedRequest.referrerPolicy,
|
|
integrity: unwrappedRequest.integrity,
|
|
timeout: unwrappedRequest.timeout
|
|
});
|
|
}
|
|
var HttpResourceImpl = class extends ResourceImpl {
|
|
client;
|
|
_headers = linkedSignal(__spreadProps(__spreadValues({}, ngDevMode ? {
|
|
debugName: "_headers"
|
|
} : {}), {
|
|
source: this.extRequest,
|
|
computation: () => void 0
|
|
}));
|
|
_progress = linkedSignal(__spreadProps(__spreadValues({}, ngDevMode ? {
|
|
debugName: "_progress"
|
|
} : {}), {
|
|
source: this.extRequest,
|
|
computation: () => void 0
|
|
}));
|
|
_statusCode = linkedSignal(__spreadProps(__spreadValues({}, ngDevMode ? {
|
|
debugName: "_statusCode"
|
|
} : {}), {
|
|
source: this.extRequest,
|
|
computation: () => void 0
|
|
}));
|
|
headers = computed(() => this.status() === "resolved" || this.status() === "error" ? this._headers() : void 0, ...ngDevMode ? [{
|
|
debugName: "headers"
|
|
}] : []);
|
|
progress = this._progress.asReadonly();
|
|
statusCode = this._statusCode.asReadonly();
|
|
constructor(injector, request, defaultValue, debugName, parse, equal, getInitialStream) {
|
|
super(request, ({
|
|
params: request2,
|
|
abortSignal
|
|
}) => {
|
|
let sub;
|
|
const onAbort = () => sub.unsubscribe();
|
|
abortSignal.addEventListener("abort", onAbort);
|
|
const stream = signal({
|
|
value: void 0
|
|
}, ...ngDevMode ? [{
|
|
debugName: "stream"
|
|
}] : []);
|
|
let resolve;
|
|
const promise = new Promise((r) => resolve = r);
|
|
const send = (value) => {
|
|
stream.set(value);
|
|
resolve?.(stream);
|
|
resolve = void 0;
|
|
};
|
|
sub = this.client.request(request2).subscribe({
|
|
next: (event) => {
|
|
switch (event.type) {
|
|
case HttpEventType.Response:
|
|
this._headers.set(event.headers);
|
|
this._statusCode.set(event.status);
|
|
try {
|
|
send({
|
|
value: parse ? parse(event.body) : event.body
|
|
});
|
|
} catch (error) {
|
|
send({
|
|
error: encapsulateResourceError(error)
|
|
});
|
|
}
|
|
break;
|
|
case HttpEventType.DownloadProgress:
|
|
this._progress.set(event);
|
|
break;
|
|
}
|
|
},
|
|
error: (error) => {
|
|
if (error instanceof HttpErrorResponse) {
|
|
this._headers.set(error.headers);
|
|
this._statusCode.set(error.status);
|
|
}
|
|
send({
|
|
error
|
|
});
|
|
abortSignal.removeEventListener("abort", onAbort);
|
|
},
|
|
complete: () => {
|
|
if (resolve) {
|
|
send({
|
|
error: new RuntimeError(991, ngDevMode && "Resource completed before producing a value")
|
|
});
|
|
}
|
|
abortSignal.removeEventListener("abort", onAbort);
|
|
}
|
|
});
|
|
return promise;
|
|
}, defaultValue, equal, debugName, injector, getInitialStream);
|
|
this.client = injector.get(HttpClient);
|
|
}
|
|
set(value) {
|
|
super.set(value);
|
|
this._headers.set(void 0);
|
|
this._progress.set(void 0);
|
|
this._statusCode.set(void 0);
|
|
}
|
|
};
|
|
|
|
// node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs
|
|
var Meta = class _Meta {
|
|
_doc;
|
|
_dom;
|
|
constructor(_doc) {
|
|
this._doc = _doc;
|
|
this._dom = getDOM();
|
|
}
|
|
addTag(tag, forceCreation = false) {
|
|
if (!tag) return null;
|
|
return this._getOrCreateElement(tag, forceCreation);
|
|
}
|
|
addTags(tags, forceCreation = false) {
|
|
if (!tags) return [];
|
|
return tags.reduce((result, tag) => {
|
|
if (tag) {
|
|
result.push(this._getOrCreateElement(tag, forceCreation));
|
|
}
|
|
return result;
|
|
}, []);
|
|
}
|
|
getTag(attrSelector) {
|
|
if (!attrSelector) return null;
|
|
return this._doc.querySelector(`meta[${attrSelector}]`) || null;
|
|
}
|
|
getTags(attrSelector) {
|
|
if (!attrSelector) return [];
|
|
const list = this._doc.querySelectorAll(`meta[${attrSelector}]`);
|
|
return list ? [].slice.call(list) : [];
|
|
}
|
|
updateTag(tag, selector) {
|
|
if (!tag) return null;
|
|
selector = selector || this._parseSelector(tag);
|
|
const meta = this.getTag(selector);
|
|
if (meta) {
|
|
return this._setMetaElementAttributes(tag, meta);
|
|
}
|
|
return this._getOrCreateElement(tag, true);
|
|
}
|
|
removeTag(attrSelector) {
|
|
this.removeTagElement(this.getTag(attrSelector));
|
|
}
|
|
removeTagElement(meta) {
|
|
if (meta) {
|
|
this._dom.remove(meta);
|
|
}
|
|
}
|
|
_getOrCreateElement(meta, forceCreation = false) {
|
|
if (!forceCreation) {
|
|
const selector = this._parseSelector(meta);
|
|
const elem = this.getTags(selector).filter((elem2) => this._containsAttributes(meta, elem2))[0];
|
|
if (elem !== void 0) return elem;
|
|
}
|
|
const element = this._dom.createElement("meta");
|
|
this._setMetaElementAttributes(meta, element);
|
|
const head = this._doc.getElementsByTagName("head")[0];
|
|
head.appendChild(element);
|
|
return element;
|
|
}
|
|
_setMetaElementAttributes(tag, el) {
|
|
Object.keys(tag).forEach((prop) => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
|
|
return el;
|
|
}
|
|
_parseSelector(tag) {
|
|
const attr = tag.name ? "name" : "property";
|
|
return `${attr}="${tag[attr]}"`;
|
|
}
|
|
_containsAttributes(tag, elem) {
|
|
return Object.keys(tag).every((key) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
|
|
}
|
|
_getMetaKeyMap(prop) {
|
|
return META_KEYS_MAP[prop] || prop;
|
|
}
|
|
static ɵfac = function Meta_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _Meta)(ɵɵinject(DOCUMENT));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _Meta,
|
|
factory: _Meta.ɵfac,
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Meta, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root"
|
|
}]
|
|
}], () => [{
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}], null);
|
|
})();
|
|
var META_KEYS_MAP = {
|
|
httpEquiv: "http-equiv"
|
|
};
|
|
var Title = class _Title {
|
|
_doc;
|
|
constructor(_doc) {
|
|
this._doc = _doc;
|
|
}
|
|
getTitle() {
|
|
return this._doc.title;
|
|
}
|
|
setTitle(newTitle) {
|
|
this._doc.title = newTitle || "";
|
|
}
|
|
static ɵfac = function Title_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _Title)(ɵɵinject(DOCUMENT));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _Title,
|
|
factory: _Title.ɵfac,
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Title, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root"
|
|
}]
|
|
}], () => [{
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}], null);
|
|
})();
|
|
function exportNgVar(name, value) {
|
|
if (typeof COMPILED === "undefined" || !COMPILED) {
|
|
const ng = _global["ng"] = _global["ng"] || {};
|
|
ng[name] = value;
|
|
}
|
|
}
|
|
var ChangeDetectionPerfRecord = class {
|
|
msPerTick;
|
|
numTicks;
|
|
constructor(msPerTick, numTicks) {
|
|
this.msPerTick = msPerTick;
|
|
this.numTicks = numTicks;
|
|
}
|
|
};
|
|
var AngularProfiler = class {
|
|
appRef;
|
|
constructor(ref) {
|
|
this.appRef = ref.injector.get(ApplicationRef);
|
|
}
|
|
timeChangeDetection(config) {
|
|
const record = config && config["record"];
|
|
const profileName = "Change Detection";
|
|
if (record && "profile" in console && typeof console.profile === "function") {
|
|
console.profile(profileName);
|
|
}
|
|
const start = performance.now();
|
|
let numTicks = 0;
|
|
while (numTicks < 5 || performance.now() - start < 500) {
|
|
this.appRef.tick();
|
|
numTicks++;
|
|
}
|
|
const end = performance.now();
|
|
if (record && "profileEnd" in console && typeof console.profileEnd === "function") {
|
|
console.profileEnd(profileName);
|
|
}
|
|
const msPerTick = (end - start) / numTicks;
|
|
console.log(`ran ${numTicks} change detection cycles`);
|
|
console.log(`${msPerTick.toFixed(2)} ms per check`);
|
|
return new ChangeDetectionPerfRecord(msPerTick, numTicks);
|
|
}
|
|
};
|
|
var PROFILER_GLOBAL_NAME = "profiler";
|
|
function enableDebugTools(ref) {
|
|
exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
|
|
return ref;
|
|
}
|
|
function disableDebugTools() {
|
|
exportNgVar(PROFILER_GLOBAL_NAME, null);
|
|
}
|
|
var By = class {
|
|
static all() {
|
|
return () => true;
|
|
}
|
|
static css(selector) {
|
|
return (debugElement) => {
|
|
return debugElement.nativeElement != null ? elementMatches(debugElement.nativeElement, selector) : false;
|
|
};
|
|
}
|
|
static directive(type) {
|
|
return (debugNode) => debugNode.providerTokens.indexOf(type) !== -1;
|
|
}
|
|
};
|
|
function elementMatches(n, selector) {
|
|
if (getDOM().isElementNode(n)) {
|
|
return n.matches && n.matches(selector) || n.msMatchesSelector && n.msMatchesSelector(selector) || n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
|
|
}
|
|
return false;
|
|
}
|
|
var EVENT_NAMES = {
|
|
"pan": true,
|
|
"panstart": true,
|
|
"panmove": true,
|
|
"panend": true,
|
|
"pancancel": true,
|
|
"panleft": true,
|
|
"panright": true,
|
|
"panup": true,
|
|
"pandown": true,
|
|
"pinch": true,
|
|
"pinchstart": true,
|
|
"pinchmove": true,
|
|
"pinchend": true,
|
|
"pinchcancel": true,
|
|
"pinchin": true,
|
|
"pinchout": true,
|
|
"press": true,
|
|
"pressup": true,
|
|
"rotate": true,
|
|
"rotatestart": true,
|
|
"rotatemove": true,
|
|
"rotateend": true,
|
|
"rotatecancel": true,
|
|
"swipe": true,
|
|
"swipeleft": true,
|
|
"swiperight": true,
|
|
"swipeup": true,
|
|
"swipedown": true,
|
|
"tap": true,
|
|
"doubletap": true
|
|
};
|
|
var HAMMER_GESTURE_CONFIG = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "HammerGestureConfig" : "");
|
|
var HAMMER_LOADER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "HammerLoader" : "");
|
|
var HammerGestureConfig = class _HammerGestureConfig {
|
|
events = [];
|
|
overrides = {};
|
|
options;
|
|
buildHammer(element) {
|
|
const mc = new Hammer(element, this.options);
|
|
mc.get("pinch").set({
|
|
enable: true
|
|
});
|
|
mc.get("rotate").set({
|
|
enable: true
|
|
});
|
|
for (const eventName in this.overrides) {
|
|
mc.get(eventName).set(this.overrides[eventName]);
|
|
}
|
|
return mc;
|
|
}
|
|
static ɵfac = function HammerGestureConfig_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HammerGestureConfig)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HammerGestureConfig,
|
|
factory: _HammerGestureConfig.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerGestureConfig, [{
|
|
type: Injectable
|
|
}], null, null);
|
|
})();
|
|
var HammerGesturesPlugin = class _HammerGesturesPlugin extends EventManagerPlugin {
|
|
_config;
|
|
_injector;
|
|
loader;
|
|
_loaderPromise = null;
|
|
constructor(doc, _config, _injector, loader) {
|
|
super(doc);
|
|
this._config = _config;
|
|
this._injector = _injector;
|
|
this.loader = loader;
|
|
}
|
|
supports(eventName) {
|
|
if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
|
|
return false;
|
|
}
|
|
if (!window.Hammer && !this.loader) {
|
|
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
const _console = this._injector.get(Console);
|
|
_console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not loaded and no custom loader has been specified.`);
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
addEventListener(element, eventName, handler) {
|
|
const zone = this.manager.getZone();
|
|
eventName = eventName.toLowerCase();
|
|
if (!window.Hammer && this.loader) {
|
|
this._loaderPromise = this._loaderPromise || zone.runOutsideAngular(() => this.loader());
|
|
let cancelRegistration = false;
|
|
let deregister = () => {
|
|
cancelRegistration = true;
|
|
};
|
|
zone.runOutsideAngular(() => this._loaderPromise.then(() => {
|
|
if (!window.Hammer) {
|
|
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
const _console = this._injector.get(Console);
|
|
_console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
|
|
}
|
|
deregister = () => {
|
|
};
|
|
return;
|
|
}
|
|
if (!cancelRegistration) {
|
|
deregister = this.addEventListener(element, eventName, handler);
|
|
}
|
|
}).catch(() => {
|
|
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
const _console = this._injector.get(Console);
|
|
_console.warn(`The "${eventName}" event cannot be bound because the custom Hammer.JS loader failed.`);
|
|
}
|
|
deregister = () => {
|
|
};
|
|
}));
|
|
return () => {
|
|
deregister();
|
|
};
|
|
}
|
|
return zone.runOutsideAngular(() => {
|
|
const mc = this._config.buildHammer(element);
|
|
const callback = function(eventObj) {
|
|
zone.runGuarded(function() {
|
|
handler(eventObj);
|
|
});
|
|
};
|
|
mc.on(eventName, callback);
|
|
return () => {
|
|
mc.off(eventName, callback);
|
|
if (typeof mc.destroy === "function") {
|
|
mc.destroy();
|
|
}
|
|
};
|
|
});
|
|
}
|
|
isCustomEvent(eventName) {
|
|
return this._config.events.indexOf(eventName) > -1;
|
|
}
|
|
static ɵfac = function HammerGesturesPlugin_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HammerGesturesPlugin)(ɵɵinject(DOCUMENT), ɵɵinject(HAMMER_GESTURE_CONFIG), ɵɵinject(Injector), ɵɵinject(HAMMER_LOADER, 8));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _HammerGesturesPlugin,
|
|
factory: _HammerGesturesPlugin.ɵfac
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerGesturesPlugin, [{
|
|
type: Injectable
|
|
}], () => [{
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}, {
|
|
type: HammerGestureConfig,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [HAMMER_GESTURE_CONFIG]
|
|
}]
|
|
}, {
|
|
type: Injector
|
|
}, {
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Optional
|
|
}, {
|
|
type: Inject,
|
|
args: [HAMMER_LOADER]
|
|
}]
|
|
}], null);
|
|
})();
|
|
var HammerModule = class _HammerModule {
|
|
static ɵfac = function HammerModule_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _HammerModule)();
|
|
};
|
|
static ɵmod = ɵɵdefineNgModule({
|
|
type: _HammerModule
|
|
});
|
|
static ɵinj = ɵɵdefineInjector({
|
|
providers: [{
|
|
provide: EVENT_MANAGER_PLUGINS,
|
|
useClass: HammerGesturesPlugin,
|
|
multi: true,
|
|
deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
|
|
}, {
|
|
provide: HAMMER_GESTURE_CONFIG,
|
|
useClass: HammerGestureConfig
|
|
}]
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerModule, [{
|
|
type: NgModule,
|
|
args: [{
|
|
providers: [{
|
|
provide: EVENT_MANAGER_PLUGINS,
|
|
useClass: HammerGesturesPlugin,
|
|
multi: true,
|
|
deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
|
|
}, {
|
|
provide: HAMMER_GESTURE_CONFIG,
|
|
useClass: HammerGestureConfig
|
|
}]
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
var DomSanitizer = class _DomSanitizer {
|
|
static ɵfac = function DomSanitizer_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _DomSanitizer)();
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _DomSanitizer,
|
|
factory: function DomSanitizer_Factory(__ngFactoryType__) {
|
|
let __ngConditionalFactory__ = null;
|
|
if (__ngFactoryType__) {
|
|
__ngConditionalFactory__ = new (__ngFactoryType__ || _DomSanitizer)();
|
|
} else {
|
|
__ngConditionalFactory__ = ɵɵinject(DomSanitizerImpl);
|
|
}
|
|
return __ngConditionalFactory__;
|
|
},
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomSanitizer, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root",
|
|
useExisting: forwardRef(() => DomSanitizerImpl)
|
|
}]
|
|
}], null, null);
|
|
})();
|
|
var DomSanitizerImpl = class _DomSanitizerImpl extends DomSanitizer {
|
|
_doc;
|
|
constructor(_doc) {
|
|
super();
|
|
this._doc = _doc;
|
|
}
|
|
sanitize(ctx, value) {
|
|
if (value == null) return null;
|
|
switch (ctx) {
|
|
case SecurityContext.NONE:
|
|
return value;
|
|
case SecurityContext.HTML:
|
|
if (allowSanitizationBypassAndThrow(value, "HTML")) {
|
|
return unwrapSafeValue(value);
|
|
}
|
|
return _sanitizeHtml(this._doc, String(value)).toString();
|
|
case SecurityContext.STYLE:
|
|
if (allowSanitizationBypassAndThrow(value, "Style")) {
|
|
return unwrapSafeValue(value);
|
|
}
|
|
return value;
|
|
case SecurityContext.SCRIPT:
|
|
if (allowSanitizationBypassAndThrow(value, "Script")) {
|
|
return unwrapSafeValue(value);
|
|
}
|
|
throw new RuntimeError(5200, (typeof ngDevMode === "undefined" || ngDevMode) && "unsafe value used in a script context");
|
|
case SecurityContext.URL:
|
|
if (allowSanitizationBypassAndThrow(value, "URL")) {
|
|
return unwrapSafeValue(value);
|
|
}
|
|
return _sanitizeUrl(String(value));
|
|
case SecurityContext.RESOURCE_URL:
|
|
if (allowSanitizationBypassAndThrow(value, "ResourceURL")) {
|
|
return unwrapSafeValue(value);
|
|
}
|
|
throw new RuntimeError(5201, (typeof ngDevMode === "undefined" || ngDevMode) && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`);
|
|
default:
|
|
throw new RuntimeError(5202, (typeof ngDevMode === "undefined" || ngDevMode) && `Unexpected SecurityContext ${ctx} (see ${XSS_SECURITY_URL})`);
|
|
}
|
|
}
|
|
bypassSecurityTrustHtml(value) {
|
|
return bypassSanitizationTrustHtml(value);
|
|
}
|
|
bypassSecurityTrustStyle(value) {
|
|
return bypassSanitizationTrustStyle(value);
|
|
}
|
|
bypassSecurityTrustScript(value) {
|
|
return bypassSanitizationTrustScript(value);
|
|
}
|
|
bypassSecurityTrustUrl(value) {
|
|
return bypassSanitizationTrustUrl(value);
|
|
}
|
|
bypassSecurityTrustResourceUrl(value) {
|
|
return bypassSanitizationTrustResourceUrl(value);
|
|
}
|
|
static ɵfac = function DomSanitizerImpl_Factory(__ngFactoryType__) {
|
|
return new (__ngFactoryType__ || _DomSanitizerImpl)(ɵɵinject(DOCUMENT));
|
|
};
|
|
static ɵprov = ɵɵdefineInjectable({
|
|
token: _DomSanitizerImpl,
|
|
factory: _DomSanitizerImpl.ɵfac,
|
|
providedIn: "root"
|
|
});
|
|
};
|
|
(() => {
|
|
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomSanitizerImpl, [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: "root"
|
|
}]
|
|
}], () => [{
|
|
type: void 0,
|
|
decorators: [{
|
|
type: Inject,
|
|
args: [DOCUMENT]
|
|
}]
|
|
}], null);
|
|
})();
|
|
var HydrationFeatureKind;
|
|
(function(HydrationFeatureKind2) {
|
|
HydrationFeatureKind2[HydrationFeatureKind2["NoHttpTransferCache"] = 0] = "NoHttpTransferCache";
|
|
HydrationFeatureKind2[HydrationFeatureKind2["HttpTransferCacheOptions"] = 1] = "HttpTransferCacheOptions";
|
|
HydrationFeatureKind2[HydrationFeatureKind2["I18nSupport"] = 2] = "I18nSupport";
|
|
HydrationFeatureKind2[HydrationFeatureKind2["EventReplay"] = 3] = "EventReplay";
|
|
HydrationFeatureKind2[HydrationFeatureKind2["IncrementalHydration"] = 4] = "IncrementalHydration";
|
|
})(HydrationFeatureKind || (HydrationFeatureKind = {}));
|
|
function hydrationFeature(ɵkind, ɵproviders = [], ɵoptions = {}) {
|
|
return {
|
|
ɵkind,
|
|
ɵproviders
|
|
};
|
|
}
|
|
function withNoHttpTransferCache() {
|
|
return hydrationFeature(HydrationFeatureKind.NoHttpTransferCache);
|
|
}
|
|
function withHttpTransferCacheOptions(options) {
|
|
return hydrationFeature(HydrationFeatureKind.HttpTransferCacheOptions, withHttpTransferCache(options));
|
|
}
|
|
function withI18nSupport2() {
|
|
return hydrationFeature(HydrationFeatureKind.I18nSupport, withI18nSupport());
|
|
}
|
|
function withEventReplay2() {
|
|
return hydrationFeature(HydrationFeatureKind.EventReplay, withEventReplay());
|
|
}
|
|
function withIncrementalHydration2() {
|
|
return hydrationFeature(HydrationFeatureKind.IncrementalHydration, withIncrementalHydration());
|
|
}
|
|
function provideEnabledBlockingInitialNavigationDetector() {
|
|
return [{
|
|
provide: ENVIRONMENT_INITIALIZER,
|
|
useValue: () => {
|
|
const isEnabledBlockingInitialNavigation = inject(IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, {
|
|
optional: true
|
|
});
|
|
if (isEnabledBlockingInitialNavigation) {
|
|
const console2 = inject(Console);
|
|
const message = formatRuntimeError(5001, "Configuration error: found both hydration and enabledBlocking initial navigation in the same application, which is a contradiction.");
|
|
console2.warn(message);
|
|
}
|
|
},
|
|
multi: true
|
|
}];
|
|
}
|
|
function provideClientHydration(...features) {
|
|
const providers = [];
|
|
const featuresKind = /* @__PURE__ */ new Set();
|
|
for (const {
|
|
ɵproviders,
|
|
ɵkind
|
|
} of features) {
|
|
featuresKind.add(ɵkind);
|
|
if (ɵproviders.length) {
|
|
providers.push(ɵproviders);
|
|
}
|
|
}
|
|
const hasHttpTransferCacheOptions = featuresKind.has(HydrationFeatureKind.HttpTransferCacheOptions);
|
|
if (typeof ngDevMode !== "undefined" && ngDevMode && featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) && hasHttpTransferCacheOptions) {
|
|
throw new RuntimeError(5001, "Configuration error: found both withHttpTransferCacheOptions() and withNoHttpTransferCache() in the same call to provideClientHydration(), which is a contradiction.");
|
|
}
|
|
return makeEnvironmentProviders([typeof ngDevMode !== "undefined" && ngDevMode ? provideEnabledBlockingInitialNavigationDetector() : [], typeof ngDevMode !== "undefined" && ngDevMode ? provideStabilityDebugging() : [], withDomHydration(), featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) || hasHttpTransferCacheOptions ? [] : withHttpTransferCache({}), providers]);
|
|
}
|
|
var VERSION = new Version("21.2.1");
|
|
|
|
export {
|
|
EventManagerPlugin,
|
|
DomEventsPlugin,
|
|
EVENT_MANAGER_PLUGINS,
|
|
EventManager,
|
|
SharedStylesHost,
|
|
REMOVE_STYLES_ON_COMPONENT_DESTROY,
|
|
DomRendererFactory2,
|
|
BrowserDomAdapter,
|
|
BrowserGetTestability,
|
|
KeyEventsPlugin,
|
|
bootstrapApplication,
|
|
createApplication,
|
|
provideProtractorTestingSupport,
|
|
platformBrowser,
|
|
BrowserModule,
|
|
Meta,
|
|
Title,
|
|
enableDebugTools,
|
|
disableDebugTools,
|
|
By,
|
|
HAMMER_GESTURE_CONFIG,
|
|
HAMMER_LOADER,
|
|
HammerGestureConfig,
|
|
HammerGesturesPlugin,
|
|
HammerModule,
|
|
DomSanitizer,
|
|
DomSanitizerImpl,
|
|
HydrationFeatureKind,
|
|
withNoHttpTransferCache,
|
|
withHttpTransferCacheOptions,
|
|
withI18nSupport2 as withI18nSupport,
|
|
withEventReplay2 as withEventReplay,
|
|
withIncrementalHydration2 as withIncrementalHydration,
|
|
provideClientHydration,
|
|
VERSION
|
|
};
|
|
//# sourceMappingURL=chunk-CQTYMEF7.js.map
|