@andersbakken/fisk-scheduler-ui 0.0.57 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/ui/browser/favicon.png +0 -0
- package/dist/ui/browser/htaccess +7 -0
- package/dist/ui/browser/index.html +1 -1
- package/dist/ui/browser/main-2ZT7BNYA.js +17 -0
- package/dist/ui/browser/package.json +50 -0
- package/dist/ui/package.json +50 -0
- package/package.json +1 -1
- package/scripts/mklinks.sh +18 -9
- package/scripts/rmlinks.sh +12 -7
- package/.angular/cache/18.2.21/ui/.tsbuildinfo +0 -1
- package/.angular/cache/18.2.21/ui/angular-compiler.db +0 -0
- package/.angular/cache/18.2.21/ui/angular-compiler.db-lock +0 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common.js +0 -201
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common_http.js +0 -85
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common_http.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_core.js +0 -932
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_core.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_forms.js +0 -134
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_forms.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_button.js +0 -33
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_button.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_card.js +0 -567
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_card.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_checkbox.js +0 -782
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_checkbox.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_core.js +0 -98
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_core.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_dialog.js +0 -1829
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_dialog.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_form-field.js +0 -45
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_form-field.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_input.js +0 -1014
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_input.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_list.js +0 -2169
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_list.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_select.js +0 -1529
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_select.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_snack-bar.js +0 -940
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_snack-bar.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_tabs.js +0 -2962
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_tabs.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser.js +0 -84
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser_animations.js +0 -4136
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser_animations.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_router.js +0 -5700
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_router.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/_metadata.json +0 -172
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-2ZKE2YDD.js +0 -1222
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-2ZKE2YDD.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-3OV72XIM.js +0 -64
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-3OV72XIM.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-57TVY4HY.js +0 -2218
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-57TVY4HY.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-A5IWFVHJ.js +0 -2374
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-A5IWFVHJ.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-DJ6HHZ3S.js +0 -1940
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-DJ6HHZ3S.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-FE6XYTIJ.js +0 -126
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-FE6XYTIJ.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-ITHJLHIY.js +0 -5795
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-ITHJLHIY.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-MFI342ZJ.js +0 -512
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-MFI342ZJ.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NPVZU53R.js +0 -6511
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NPVZU53R.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NSRJEU3V.js +0 -27918
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NSRJEU3V.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-R2N6IWJV.js +0 -5116
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-R2N6IWJV.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-TO3SXVFJ.js +0 -2840
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-TO3SXVFJ.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WFLMTRZP.js +0 -379
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WFLMTRZP.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WQ5YUVUS.js +0 -1534
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WQ5YUVUS.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/ngx-color-picker.js +0 -2925
- package/.angular/cache/18.2.21/ui/vite/deps/ngx-color-picker.js.map +0 -7
- package/.angular/cache/18.2.21/ui/vite/deps/seedrandom.js +0 -703
- package/.angular/cache/18.2.21/ui/vite/deps/seedrandom.js.map +0 -7
- package/dist/ui/browser/main-6SIZHY3G.js +0 -17
- package/scripts/mock-scheduler.js +0 -350
- package/scripts/test-live-model.js +0 -286
|
@@ -1,2374 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DOCUMENT,
|
|
3
|
-
XhrFactory,
|
|
4
|
-
isPlatformServer,
|
|
5
|
-
parseCookieValue
|
|
6
|
-
} from "./chunk-R2N6IWJV.js";
|
|
7
|
-
import {
|
|
8
|
-
APP_BOOTSTRAP_LISTENER,
|
|
9
|
-
ApplicationRef,
|
|
10
|
-
Console,
|
|
11
|
-
EnvironmentInjector,
|
|
12
|
-
Inject,
|
|
13
|
-
Injectable,
|
|
14
|
-
InjectionToken,
|
|
15
|
-
NgModule,
|
|
16
|
-
NgZone,
|
|
17
|
-
Observable,
|
|
18
|
-
PLATFORM_ID,
|
|
19
|
-
PendingTasks,
|
|
20
|
-
RuntimeError,
|
|
21
|
-
TransferState,
|
|
22
|
-
concatMap,
|
|
23
|
-
filter,
|
|
24
|
-
finalize,
|
|
25
|
-
formatRuntimeError,
|
|
26
|
-
from,
|
|
27
|
-
inject,
|
|
28
|
-
makeEnvironmentProviders,
|
|
29
|
-
makeStateKey,
|
|
30
|
-
map,
|
|
31
|
-
of,
|
|
32
|
-
performanceMarkFeature,
|
|
33
|
-
runInInjectionContext,
|
|
34
|
-
setClassMetadata,
|
|
35
|
-
switchMap,
|
|
36
|
-
tap,
|
|
37
|
-
truncateMiddle,
|
|
38
|
-
whenStable,
|
|
39
|
-
ɵɵdefineInjectable,
|
|
40
|
-
ɵɵdefineInjector,
|
|
41
|
-
ɵɵdefineNgModule,
|
|
42
|
-
ɵɵinject
|
|
43
|
-
} from "./chunk-NSRJEU3V.js";
|
|
44
|
-
import {
|
|
45
|
-
__async,
|
|
46
|
-
__objRest,
|
|
47
|
-
__spreadValues
|
|
48
|
-
} from "./chunk-3OV72XIM.js";
|
|
49
|
-
|
|
50
|
-
// node_modules/@angular/common/fesm2022/http.mjs
|
|
51
|
-
var HttpHandler = class {
|
|
52
|
-
};
|
|
53
|
-
var HttpBackend = class {
|
|
54
|
-
};
|
|
55
|
-
var HttpHeaders = class _HttpHeaders {
|
|
56
|
-
/** Constructs a new HTTP header object with the given values.*/
|
|
57
|
-
constructor(headers) {
|
|
58
|
-
this.normalizedNames = /* @__PURE__ */ new Map();
|
|
59
|
-
this.lazyUpdate = null;
|
|
60
|
-
if (!headers) {
|
|
61
|
-
this.headers = /* @__PURE__ */ new Map();
|
|
62
|
-
} else if (typeof headers === "string") {
|
|
63
|
-
this.lazyInit = () => {
|
|
64
|
-
this.headers = /* @__PURE__ */ new Map();
|
|
65
|
-
headers.split("\n").forEach((line) => {
|
|
66
|
-
const index = line.indexOf(":");
|
|
67
|
-
if (index > 0) {
|
|
68
|
-
const name = line.slice(0, index);
|
|
69
|
-
const key = name.toLowerCase();
|
|
70
|
-
const value = line.slice(index + 1).trim();
|
|
71
|
-
this.maybeSetNormalizedName(name, key);
|
|
72
|
-
if (this.headers.has(key)) {
|
|
73
|
-
this.headers.get(key).push(value);
|
|
74
|
-
} else {
|
|
75
|
-
this.headers.set(key, [value]);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
} else if (typeof Headers !== "undefined" && headers instanceof Headers) {
|
|
81
|
-
this.headers = /* @__PURE__ */ new Map();
|
|
82
|
-
headers.forEach((values, name) => {
|
|
83
|
-
this.setHeaderEntries(name, values);
|
|
84
|
-
});
|
|
85
|
-
} else {
|
|
86
|
-
this.lazyInit = () => {
|
|
87
|
-
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
88
|
-
assertValidHeaders(headers);
|
|
89
|
-
}
|
|
90
|
-
this.headers = /* @__PURE__ */ new Map();
|
|
91
|
-
Object.entries(headers).forEach(([name, values]) => {
|
|
92
|
-
this.setHeaderEntries(name, values);
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Checks for existence of a given header.
|
|
99
|
-
*
|
|
100
|
-
* @param name The header name to check for existence.
|
|
101
|
-
*
|
|
102
|
-
* @returns True if the header exists, false otherwise.
|
|
103
|
-
*/
|
|
104
|
-
has(name) {
|
|
105
|
-
this.init();
|
|
106
|
-
return this.headers.has(name.toLowerCase());
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Retrieves the first value of a given header.
|
|
110
|
-
*
|
|
111
|
-
* @param name The header name.
|
|
112
|
-
*
|
|
113
|
-
* @returns The value string if the header exists, null otherwise
|
|
114
|
-
*/
|
|
115
|
-
get(name) {
|
|
116
|
-
this.init();
|
|
117
|
-
const values = this.headers.get(name.toLowerCase());
|
|
118
|
-
return values && values.length > 0 ? values[0] : null;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Retrieves the names of the headers.
|
|
122
|
-
*
|
|
123
|
-
* @returns A list of header names.
|
|
124
|
-
*/
|
|
125
|
-
keys() {
|
|
126
|
-
this.init();
|
|
127
|
-
return Array.from(this.normalizedNames.values());
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Retrieves a list of values for a given header.
|
|
131
|
-
*
|
|
132
|
-
* @param name The header name from which to retrieve values.
|
|
133
|
-
*
|
|
134
|
-
* @returns A string of values if the header exists, null otherwise.
|
|
135
|
-
*/
|
|
136
|
-
getAll(name) {
|
|
137
|
-
this.init();
|
|
138
|
-
return this.headers.get(name.toLowerCase()) || null;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Appends a new value to the existing set of values for a header
|
|
142
|
-
* and returns them in a clone of the original instance.
|
|
143
|
-
*
|
|
144
|
-
* @param name The header name for which to append the values.
|
|
145
|
-
* @param value The value to append.
|
|
146
|
-
*
|
|
147
|
-
* @returns A clone of the HTTP headers object with the value appended to the given header.
|
|
148
|
-
*/
|
|
149
|
-
append(name, value) {
|
|
150
|
-
return this.clone({
|
|
151
|
-
name,
|
|
152
|
-
value,
|
|
153
|
-
op: "a"
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Sets or modifies a value for a given header in a clone of the original instance.
|
|
158
|
-
* If the header already exists, its value is replaced with the given value
|
|
159
|
-
* in the returned object.
|
|
160
|
-
*
|
|
161
|
-
* @param name The header name.
|
|
162
|
-
* @param value The value or values to set or override for the given header.
|
|
163
|
-
*
|
|
164
|
-
* @returns A clone of the HTTP headers object with the newly set header value.
|
|
165
|
-
*/
|
|
166
|
-
set(name, value) {
|
|
167
|
-
return this.clone({
|
|
168
|
-
name,
|
|
169
|
-
value,
|
|
170
|
-
op: "s"
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Deletes values for a given header in a clone of the original instance.
|
|
175
|
-
*
|
|
176
|
-
* @param name The header name.
|
|
177
|
-
* @param value The value or values to delete for the given header.
|
|
178
|
-
*
|
|
179
|
-
* @returns A clone of the HTTP headers object with the given value deleted.
|
|
180
|
-
*/
|
|
181
|
-
delete(name, value) {
|
|
182
|
-
return this.clone({
|
|
183
|
-
name,
|
|
184
|
-
value,
|
|
185
|
-
op: "d"
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
maybeSetNormalizedName(name, lcName) {
|
|
189
|
-
if (!this.normalizedNames.has(lcName)) {
|
|
190
|
-
this.normalizedNames.set(lcName, name);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
init() {
|
|
194
|
-
if (!!this.lazyInit) {
|
|
195
|
-
if (this.lazyInit instanceof _HttpHeaders) {
|
|
196
|
-
this.copyFrom(this.lazyInit);
|
|
197
|
-
} else {
|
|
198
|
-
this.lazyInit();
|
|
199
|
-
}
|
|
200
|
-
this.lazyInit = null;
|
|
201
|
-
if (!!this.lazyUpdate) {
|
|
202
|
-
this.lazyUpdate.forEach((update) => this.applyUpdate(update));
|
|
203
|
-
this.lazyUpdate = null;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
copyFrom(other) {
|
|
208
|
-
other.init();
|
|
209
|
-
Array.from(other.headers.keys()).forEach((key) => {
|
|
210
|
-
this.headers.set(key, other.headers.get(key));
|
|
211
|
-
this.normalizedNames.set(key, other.normalizedNames.get(key));
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
clone(update) {
|
|
215
|
-
const clone = new _HttpHeaders();
|
|
216
|
-
clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof _HttpHeaders ? this.lazyInit : this;
|
|
217
|
-
clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
|
|
218
|
-
return clone;
|
|
219
|
-
}
|
|
220
|
-
applyUpdate(update) {
|
|
221
|
-
const key = update.name.toLowerCase();
|
|
222
|
-
switch (update.op) {
|
|
223
|
-
case "a":
|
|
224
|
-
case "s":
|
|
225
|
-
let value = update.value;
|
|
226
|
-
if (typeof value === "string") {
|
|
227
|
-
value = [value];
|
|
228
|
-
}
|
|
229
|
-
if (value.length === 0) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
this.maybeSetNormalizedName(update.name, key);
|
|
233
|
-
const base = (update.op === "a" ? this.headers.get(key) : void 0) || [];
|
|
234
|
-
base.push(...value);
|
|
235
|
-
this.headers.set(key, base);
|
|
236
|
-
break;
|
|
237
|
-
case "d":
|
|
238
|
-
const toDelete = update.value;
|
|
239
|
-
if (!toDelete) {
|
|
240
|
-
this.headers.delete(key);
|
|
241
|
-
this.normalizedNames.delete(key);
|
|
242
|
-
} else {
|
|
243
|
-
let existing = this.headers.get(key);
|
|
244
|
-
if (!existing) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
existing = existing.filter((value2) => toDelete.indexOf(value2) === -1);
|
|
248
|
-
if (existing.length === 0) {
|
|
249
|
-
this.headers.delete(key);
|
|
250
|
-
this.normalizedNames.delete(key);
|
|
251
|
-
} else {
|
|
252
|
-
this.headers.set(key, existing);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
setHeaderEntries(name, values) {
|
|
259
|
-
const headerValues = (Array.isArray(values) ? values : [values]).map((value) => value.toString());
|
|
260
|
-
const key = name.toLowerCase();
|
|
261
|
-
this.headers.set(key, headerValues);
|
|
262
|
-
this.maybeSetNormalizedName(name, key);
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* @internal
|
|
266
|
-
*/
|
|
267
|
-
forEach(fn) {
|
|
268
|
-
this.init();
|
|
269
|
-
Array.from(this.normalizedNames.keys()).forEach((key) => fn(this.normalizedNames.get(key), this.headers.get(key)));
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
function assertValidHeaders(headers) {
|
|
273
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
274
|
-
if (!(typeof value === "string" || typeof value === "number") && !Array.isArray(value)) {
|
|
275
|
-
throw new Error(`Unexpected value of the \`${key}\` header provided. Expecting either a string, a number or an array, but got: \`${value}\`.`);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
var HttpUrlEncodingCodec = class {
|
|
280
|
-
/**
|
|
281
|
-
* Encodes a key name for a URL parameter or query-string.
|
|
282
|
-
* @param key The key name.
|
|
283
|
-
* @returns The encoded key name.
|
|
284
|
-
*/
|
|
285
|
-
encodeKey(key) {
|
|
286
|
-
return standardEncoding(key);
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Encodes the value of a URL parameter or query-string.
|
|
290
|
-
* @param value The value.
|
|
291
|
-
* @returns The encoded value.
|
|
292
|
-
*/
|
|
293
|
-
encodeValue(value) {
|
|
294
|
-
return standardEncoding(value);
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Decodes an encoded URL parameter or query-string key.
|
|
298
|
-
* @param key The encoded key name.
|
|
299
|
-
* @returns The decoded key name.
|
|
300
|
-
*/
|
|
301
|
-
decodeKey(key) {
|
|
302
|
-
return decodeURIComponent(key);
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Decodes an encoded URL parameter or query-string value.
|
|
306
|
-
* @param value The encoded value.
|
|
307
|
-
* @returns The decoded value.
|
|
308
|
-
*/
|
|
309
|
-
decodeValue(value) {
|
|
310
|
-
return decodeURIComponent(value);
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
function paramParser(rawParams, codec) {
|
|
314
|
-
const map2 = /* @__PURE__ */ new Map();
|
|
315
|
-
if (rawParams.length > 0) {
|
|
316
|
-
const params = rawParams.replace(/^\?/, "").split("&");
|
|
317
|
-
params.forEach((param) => {
|
|
318
|
-
const eqIdx = param.indexOf("=");
|
|
319
|
-
const [key, val] = eqIdx == -1 ? [codec.decodeKey(param), ""] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];
|
|
320
|
-
const list = map2.get(key) || [];
|
|
321
|
-
list.push(val);
|
|
322
|
-
map2.set(key, list);
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
return map2;
|
|
326
|
-
}
|
|
327
|
-
var STANDARD_ENCODING_REGEX = /%(\d[a-f0-9])/gi;
|
|
328
|
-
var STANDARD_ENCODING_REPLACEMENTS = {
|
|
329
|
-
"40": "@",
|
|
330
|
-
"3A": ":",
|
|
331
|
-
"24": "$",
|
|
332
|
-
"2C": ",",
|
|
333
|
-
"3B": ";",
|
|
334
|
-
"3D": "=",
|
|
335
|
-
"3F": "?",
|
|
336
|
-
"2F": "/"
|
|
337
|
-
};
|
|
338
|
-
function standardEncoding(v) {
|
|
339
|
-
return encodeURIComponent(v).replace(STANDARD_ENCODING_REGEX, (s, t) => STANDARD_ENCODING_REPLACEMENTS[t] ?? s);
|
|
340
|
-
}
|
|
341
|
-
function valueToString(value) {
|
|
342
|
-
return `${value}`;
|
|
343
|
-
}
|
|
344
|
-
var HttpParams = class _HttpParams {
|
|
345
|
-
constructor(options = {}) {
|
|
346
|
-
this.updates = null;
|
|
347
|
-
this.cloneFrom = null;
|
|
348
|
-
this.encoder = options.encoder || new HttpUrlEncodingCodec();
|
|
349
|
-
if (!!options.fromString) {
|
|
350
|
-
if (!!options.fromObject) {
|
|
351
|
-
throw new Error(`Cannot specify both fromString and fromObject.`);
|
|
352
|
-
}
|
|
353
|
-
this.map = paramParser(options.fromString, this.encoder);
|
|
354
|
-
} else if (!!options.fromObject) {
|
|
355
|
-
this.map = /* @__PURE__ */ new Map();
|
|
356
|
-
Object.keys(options.fromObject).forEach((key) => {
|
|
357
|
-
const value = options.fromObject[key];
|
|
358
|
-
const values = Array.isArray(value) ? value.map(valueToString) : [valueToString(value)];
|
|
359
|
-
this.map.set(key, values);
|
|
360
|
-
});
|
|
361
|
-
} else {
|
|
362
|
-
this.map = null;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Reports whether the body includes one or more values for a given parameter.
|
|
367
|
-
* @param param The parameter name.
|
|
368
|
-
* @returns True if the parameter has one or more values,
|
|
369
|
-
* false if it has no value or is not present.
|
|
370
|
-
*/
|
|
371
|
-
has(param) {
|
|
372
|
-
this.init();
|
|
373
|
-
return this.map.has(param);
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Retrieves the first value for a parameter.
|
|
377
|
-
* @param param The parameter name.
|
|
378
|
-
* @returns The first value of the given parameter,
|
|
379
|
-
* or `null` if the parameter is not present.
|
|
380
|
-
*/
|
|
381
|
-
get(param) {
|
|
382
|
-
this.init();
|
|
383
|
-
const res = this.map.get(param);
|
|
384
|
-
return !!res ? res[0] : null;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Retrieves all values for a parameter.
|
|
388
|
-
* @param param The parameter name.
|
|
389
|
-
* @returns All values in a string array,
|
|
390
|
-
* or `null` if the parameter not present.
|
|
391
|
-
*/
|
|
392
|
-
getAll(param) {
|
|
393
|
-
this.init();
|
|
394
|
-
return this.map.get(param) || null;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Retrieves all the parameters for this body.
|
|
398
|
-
* @returns The parameter names in a string array.
|
|
399
|
-
*/
|
|
400
|
-
keys() {
|
|
401
|
-
this.init();
|
|
402
|
-
return Array.from(this.map.keys());
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Appends a new value to existing values for a parameter.
|
|
406
|
-
* @param param The parameter name.
|
|
407
|
-
* @param value The new value to add.
|
|
408
|
-
* @return A new body with the appended value.
|
|
409
|
-
*/
|
|
410
|
-
append(param, value) {
|
|
411
|
-
return this.clone({
|
|
412
|
-
param,
|
|
413
|
-
value,
|
|
414
|
-
op: "a"
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Constructs a new body with appended values for the given parameter name.
|
|
419
|
-
* @param params parameters and values
|
|
420
|
-
* @return A new body with the new value.
|
|
421
|
-
*/
|
|
422
|
-
appendAll(params) {
|
|
423
|
-
const updates = [];
|
|
424
|
-
Object.keys(params).forEach((param) => {
|
|
425
|
-
const value = params[param];
|
|
426
|
-
if (Array.isArray(value)) {
|
|
427
|
-
value.forEach((_value) => {
|
|
428
|
-
updates.push({
|
|
429
|
-
param,
|
|
430
|
-
value: _value,
|
|
431
|
-
op: "a"
|
|
432
|
-
});
|
|
433
|
-
});
|
|
434
|
-
} else {
|
|
435
|
-
updates.push({
|
|
436
|
-
param,
|
|
437
|
-
value,
|
|
438
|
-
op: "a"
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
return this.clone(updates);
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Replaces the value for a parameter.
|
|
446
|
-
* @param param The parameter name.
|
|
447
|
-
* @param value The new value.
|
|
448
|
-
* @return A new body with the new value.
|
|
449
|
-
*/
|
|
450
|
-
set(param, value) {
|
|
451
|
-
return this.clone({
|
|
452
|
-
param,
|
|
453
|
-
value,
|
|
454
|
-
op: "s"
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Removes a given value or all values from a parameter.
|
|
459
|
-
* @param param The parameter name.
|
|
460
|
-
* @param value The value to remove, if provided.
|
|
461
|
-
* @return A new body with the given value removed, or with all values
|
|
462
|
-
* removed if no value is specified.
|
|
463
|
-
*/
|
|
464
|
-
delete(param, value) {
|
|
465
|
-
return this.clone({
|
|
466
|
-
param,
|
|
467
|
-
value,
|
|
468
|
-
op: "d"
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
|
|
473
|
-
* separated by `&`s.
|
|
474
|
-
*/
|
|
475
|
-
toString() {
|
|
476
|
-
this.init();
|
|
477
|
-
return this.keys().map((key) => {
|
|
478
|
-
const eKey = this.encoder.encodeKey(key);
|
|
479
|
-
return this.map.get(key).map((value) => eKey + "=" + this.encoder.encodeValue(value)).join("&");
|
|
480
|
-
}).filter((param) => param !== "").join("&");
|
|
481
|
-
}
|
|
482
|
-
clone(update) {
|
|
483
|
-
const clone = new _HttpParams({
|
|
484
|
-
encoder: this.encoder
|
|
485
|
-
});
|
|
486
|
-
clone.cloneFrom = this.cloneFrom || this;
|
|
487
|
-
clone.updates = (this.updates || []).concat(update);
|
|
488
|
-
return clone;
|
|
489
|
-
}
|
|
490
|
-
init() {
|
|
491
|
-
if (this.map === null) {
|
|
492
|
-
this.map = /* @__PURE__ */ new Map();
|
|
493
|
-
}
|
|
494
|
-
if (this.cloneFrom !== null) {
|
|
495
|
-
this.cloneFrom.init();
|
|
496
|
-
this.cloneFrom.keys().forEach((key) => this.map.set(key, this.cloneFrom.map.get(key)));
|
|
497
|
-
this.updates.forEach((update) => {
|
|
498
|
-
switch (update.op) {
|
|
499
|
-
case "a":
|
|
500
|
-
case "s":
|
|
501
|
-
const base = (update.op === "a" ? this.map.get(update.param) : void 0) || [];
|
|
502
|
-
base.push(valueToString(update.value));
|
|
503
|
-
this.map.set(update.param, base);
|
|
504
|
-
break;
|
|
505
|
-
case "d":
|
|
506
|
-
if (update.value !== void 0) {
|
|
507
|
-
let base2 = this.map.get(update.param) || [];
|
|
508
|
-
const idx = base2.indexOf(valueToString(update.value));
|
|
509
|
-
if (idx !== -1) {
|
|
510
|
-
base2.splice(idx, 1);
|
|
511
|
-
}
|
|
512
|
-
if (base2.length > 0) {
|
|
513
|
-
this.map.set(update.param, base2);
|
|
514
|
-
} else {
|
|
515
|
-
this.map.delete(update.param);
|
|
516
|
-
}
|
|
517
|
-
} else {
|
|
518
|
-
this.map.delete(update.param);
|
|
519
|
-
break;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
this.cloneFrom = this.updates = null;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
};
|
|
527
|
-
var HttpContextToken = class {
|
|
528
|
-
constructor(defaultValue) {
|
|
529
|
-
this.defaultValue = defaultValue;
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
var HttpContext = class {
|
|
533
|
-
constructor() {
|
|
534
|
-
this.map = /* @__PURE__ */ new Map();
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Store a value in the context. If a value is already present it will be overwritten.
|
|
538
|
-
*
|
|
539
|
-
* @param token The reference to an instance of `HttpContextToken`.
|
|
540
|
-
* @param value The value to store.
|
|
541
|
-
*
|
|
542
|
-
* @returns A reference to itself for easy chaining.
|
|
543
|
-
*/
|
|
544
|
-
set(token, value) {
|
|
545
|
-
this.map.set(token, value);
|
|
546
|
-
return this;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Retrieve the value associated with the given token.
|
|
550
|
-
*
|
|
551
|
-
* @param token The reference to an instance of `HttpContextToken`.
|
|
552
|
-
*
|
|
553
|
-
* @returns The stored value or default if one is defined.
|
|
554
|
-
*/
|
|
555
|
-
get(token) {
|
|
556
|
-
if (!this.map.has(token)) {
|
|
557
|
-
this.map.set(token, token.defaultValue());
|
|
558
|
-
}
|
|
559
|
-
return this.map.get(token);
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Delete the value associated with the given token.
|
|
563
|
-
*
|
|
564
|
-
* @param token The reference to an instance of `HttpContextToken`.
|
|
565
|
-
*
|
|
566
|
-
* @returns A reference to itself for easy chaining.
|
|
567
|
-
*/
|
|
568
|
-
delete(token) {
|
|
569
|
-
this.map.delete(token);
|
|
570
|
-
return this;
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* Checks for existence of a given token.
|
|
574
|
-
*
|
|
575
|
-
* @param token The reference to an instance of `HttpContextToken`.
|
|
576
|
-
*
|
|
577
|
-
* @returns True if the token exists, false otherwise.
|
|
578
|
-
*/
|
|
579
|
-
has(token) {
|
|
580
|
-
return this.map.has(token);
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* @returns a list of tokens currently stored in the context.
|
|
584
|
-
*/
|
|
585
|
-
keys() {
|
|
586
|
-
return this.map.keys();
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
function mightHaveBody(method) {
|
|
590
|
-
switch (method) {
|
|
591
|
-
case "DELETE":
|
|
592
|
-
case "GET":
|
|
593
|
-
case "HEAD":
|
|
594
|
-
case "OPTIONS":
|
|
595
|
-
case "JSONP":
|
|
596
|
-
return false;
|
|
597
|
-
default:
|
|
598
|
-
return true;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
function isArrayBuffer(value) {
|
|
602
|
-
return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
|
|
603
|
-
}
|
|
604
|
-
function isBlob(value) {
|
|
605
|
-
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
606
|
-
}
|
|
607
|
-
function isFormData(value) {
|
|
608
|
-
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
609
|
-
}
|
|
610
|
-
function isUrlSearchParams(value) {
|
|
611
|
-
return typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams;
|
|
612
|
-
}
|
|
613
|
-
var HttpRequest = class _HttpRequest {
|
|
614
|
-
constructor(method, url, third, fourth) {
|
|
615
|
-
this.url = url;
|
|
616
|
-
this.body = null;
|
|
617
|
-
this.reportProgress = false;
|
|
618
|
-
this.withCredentials = false;
|
|
619
|
-
this.responseType = "json";
|
|
620
|
-
this.method = method.toUpperCase();
|
|
621
|
-
let options;
|
|
622
|
-
if (mightHaveBody(this.method) || !!fourth) {
|
|
623
|
-
this.body = third !== void 0 ? third : null;
|
|
624
|
-
options = fourth;
|
|
625
|
-
} else {
|
|
626
|
-
options = third;
|
|
627
|
-
}
|
|
628
|
-
if (options) {
|
|
629
|
-
this.reportProgress = !!options.reportProgress;
|
|
630
|
-
this.withCredentials = !!options.withCredentials;
|
|
631
|
-
if (!!options.responseType) {
|
|
632
|
-
this.responseType = options.responseType;
|
|
633
|
-
}
|
|
634
|
-
if (!!options.headers) {
|
|
635
|
-
this.headers = options.headers;
|
|
636
|
-
}
|
|
637
|
-
if (!!options.context) {
|
|
638
|
-
this.context = options.context;
|
|
639
|
-
}
|
|
640
|
-
if (!!options.params) {
|
|
641
|
-
this.params = options.params;
|
|
642
|
-
}
|
|
643
|
-
this.transferCache = options.transferCache;
|
|
644
|
-
}
|
|
645
|
-
this.headers ??= new HttpHeaders();
|
|
646
|
-
this.context ??= new HttpContext();
|
|
647
|
-
if (!this.params) {
|
|
648
|
-
this.params = new HttpParams();
|
|
649
|
-
this.urlWithParams = url;
|
|
650
|
-
} else {
|
|
651
|
-
const params = this.params.toString();
|
|
652
|
-
if (params.length === 0) {
|
|
653
|
-
this.urlWithParams = url;
|
|
654
|
-
} else {
|
|
655
|
-
const qIdx = url.indexOf("?");
|
|
656
|
-
const sep = qIdx === -1 ? "?" : qIdx < url.length - 1 ? "&" : "";
|
|
657
|
-
this.urlWithParams = url + sep + params;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Transform the free-form body into a serialized format suitable for
|
|
663
|
-
* transmission to the server.
|
|
664
|
-
*/
|
|
665
|
-
serializeBody() {
|
|
666
|
-
if (this.body === null) {
|
|
667
|
-
return null;
|
|
668
|
-
}
|
|
669
|
-
if (typeof this.body === "string" || isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || isUrlSearchParams(this.body)) {
|
|
670
|
-
return this.body;
|
|
671
|
-
}
|
|
672
|
-
if (this.body instanceof HttpParams) {
|
|
673
|
-
return this.body.toString();
|
|
674
|
-
}
|
|
675
|
-
if (typeof this.body === "object" || typeof this.body === "boolean" || Array.isArray(this.body)) {
|
|
676
|
-
return JSON.stringify(this.body);
|
|
677
|
-
}
|
|
678
|
-
return this.body.toString();
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Examine the body and attempt to infer an appropriate MIME type
|
|
682
|
-
* for it.
|
|
683
|
-
*
|
|
684
|
-
* If no such type can be inferred, this method will return `null`.
|
|
685
|
-
*/
|
|
686
|
-
detectContentTypeHeader() {
|
|
687
|
-
if (this.body === null) {
|
|
688
|
-
return null;
|
|
689
|
-
}
|
|
690
|
-
if (isFormData(this.body)) {
|
|
691
|
-
return null;
|
|
692
|
-
}
|
|
693
|
-
if (isBlob(this.body)) {
|
|
694
|
-
return this.body.type || null;
|
|
695
|
-
}
|
|
696
|
-
if (isArrayBuffer(this.body)) {
|
|
697
|
-
return null;
|
|
698
|
-
}
|
|
699
|
-
if (typeof this.body === "string") {
|
|
700
|
-
return "text/plain";
|
|
701
|
-
}
|
|
702
|
-
if (this.body instanceof HttpParams) {
|
|
703
|
-
return "application/x-www-form-urlencoded;charset=UTF-8";
|
|
704
|
-
}
|
|
705
|
-
if (typeof this.body === "object" || typeof this.body === "number" || typeof this.body === "boolean") {
|
|
706
|
-
return "application/json";
|
|
707
|
-
}
|
|
708
|
-
return null;
|
|
709
|
-
}
|
|
710
|
-
clone(update = {}) {
|
|
711
|
-
const method = update.method || this.method;
|
|
712
|
-
const url = update.url || this.url;
|
|
713
|
-
const responseType = update.responseType || this.responseType;
|
|
714
|
-
const transferCache = update.transferCache ?? this.transferCache;
|
|
715
|
-
const body = update.body !== void 0 ? update.body : this.body;
|
|
716
|
-
const withCredentials = update.withCredentials ?? this.withCredentials;
|
|
717
|
-
const reportProgress = update.reportProgress ?? this.reportProgress;
|
|
718
|
-
let headers = update.headers || this.headers;
|
|
719
|
-
let params = update.params || this.params;
|
|
720
|
-
const context = update.context ?? this.context;
|
|
721
|
-
if (update.setHeaders !== void 0) {
|
|
722
|
-
headers = Object.keys(update.setHeaders).reduce((headers2, name) => headers2.set(name, update.setHeaders[name]), headers);
|
|
723
|
-
}
|
|
724
|
-
if (update.setParams) {
|
|
725
|
-
params = Object.keys(update.setParams).reduce((params2, param) => params2.set(param, update.setParams[param]), params);
|
|
726
|
-
}
|
|
727
|
-
return new _HttpRequest(method, url, body, {
|
|
728
|
-
params,
|
|
729
|
-
headers,
|
|
730
|
-
context,
|
|
731
|
-
reportProgress,
|
|
732
|
-
responseType,
|
|
733
|
-
withCredentials,
|
|
734
|
-
transferCache
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
var HttpEventType;
|
|
739
|
-
(function(HttpEventType2) {
|
|
740
|
-
HttpEventType2[HttpEventType2["Sent"] = 0] = "Sent";
|
|
741
|
-
HttpEventType2[HttpEventType2["UploadProgress"] = 1] = "UploadProgress";
|
|
742
|
-
HttpEventType2[HttpEventType2["ResponseHeader"] = 2] = "ResponseHeader";
|
|
743
|
-
HttpEventType2[HttpEventType2["DownloadProgress"] = 3] = "DownloadProgress";
|
|
744
|
-
HttpEventType2[HttpEventType2["Response"] = 4] = "Response";
|
|
745
|
-
HttpEventType2[HttpEventType2["User"] = 5] = "User";
|
|
746
|
-
})(HttpEventType || (HttpEventType = {}));
|
|
747
|
-
var HttpResponseBase = class {
|
|
748
|
-
/**
|
|
749
|
-
* Super-constructor for all responses.
|
|
750
|
-
*
|
|
751
|
-
* The single parameter accepted is an initialization hash. Any properties
|
|
752
|
-
* of the response passed there will override the default values.
|
|
753
|
-
*/
|
|
754
|
-
constructor(init, defaultStatus = 200, defaultStatusText = "OK") {
|
|
755
|
-
this.headers = init.headers || new HttpHeaders();
|
|
756
|
-
this.status = init.status !== void 0 ? init.status : defaultStatus;
|
|
757
|
-
this.statusText = init.statusText || defaultStatusText;
|
|
758
|
-
this.url = init.url || null;
|
|
759
|
-
this.ok = this.status >= 200 && this.status < 300;
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
var HttpHeaderResponse = class _HttpHeaderResponse extends HttpResponseBase {
|
|
763
|
-
/**
|
|
764
|
-
* Create a new `HttpHeaderResponse` with the given parameters.
|
|
765
|
-
*/
|
|
766
|
-
constructor(init = {}) {
|
|
767
|
-
super(init);
|
|
768
|
-
this.type = HttpEventType.ResponseHeader;
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* Copy this `HttpHeaderResponse`, overriding its contents with the
|
|
772
|
-
* given parameter hash.
|
|
773
|
-
*/
|
|
774
|
-
clone(update = {}) {
|
|
775
|
-
return new _HttpHeaderResponse({
|
|
776
|
-
headers: update.headers || this.headers,
|
|
777
|
-
status: update.status !== void 0 ? update.status : this.status,
|
|
778
|
-
statusText: update.statusText || this.statusText,
|
|
779
|
-
url: update.url || this.url || void 0
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
var HttpResponse = class _HttpResponse extends HttpResponseBase {
|
|
784
|
-
/**
|
|
785
|
-
* Construct a new `HttpResponse`.
|
|
786
|
-
*/
|
|
787
|
-
constructor(init = {}) {
|
|
788
|
-
super(init);
|
|
789
|
-
this.type = HttpEventType.Response;
|
|
790
|
-
this.body = init.body !== void 0 ? init.body : null;
|
|
791
|
-
}
|
|
792
|
-
clone(update = {}) {
|
|
793
|
-
return new _HttpResponse({
|
|
794
|
-
body: update.body !== void 0 ? update.body : this.body,
|
|
795
|
-
headers: update.headers || this.headers,
|
|
796
|
-
status: update.status !== void 0 ? update.status : this.status,
|
|
797
|
-
statusText: update.statusText || this.statusText,
|
|
798
|
-
url: update.url || this.url || void 0
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
var HttpErrorResponse = class extends HttpResponseBase {
|
|
803
|
-
constructor(init) {
|
|
804
|
-
super(init, 0, "Unknown Error");
|
|
805
|
-
this.name = "HttpErrorResponse";
|
|
806
|
-
this.ok = false;
|
|
807
|
-
if (this.status >= 200 && this.status < 300) {
|
|
808
|
-
this.message = `Http failure during parsing for ${init.url || "(unknown url)"}`;
|
|
809
|
-
} else {
|
|
810
|
-
this.message = `Http failure response for ${init.url || "(unknown url)"}: ${init.status} ${init.statusText}`;
|
|
811
|
-
}
|
|
812
|
-
this.error = init.error || null;
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
var HTTP_STATUS_CODE_OK = 200;
|
|
816
|
-
var HTTP_STATUS_CODE_NO_CONTENT = 204;
|
|
817
|
-
var HttpStatusCode;
|
|
818
|
-
(function(HttpStatusCode2) {
|
|
819
|
-
HttpStatusCode2[HttpStatusCode2["Continue"] = 100] = "Continue";
|
|
820
|
-
HttpStatusCode2[HttpStatusCode2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
821
|
-
HttpStatusCode2[HttpStatusCode2["Processing"] = 102] = "Processing";
|
|
822
|
-
HttpStatusCode2[HttpStatusCode2["EarlyHints"] = 103] = "EarlyHints";
|
|
823
|
-
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
824
|
-
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
825
|
-
HttpStatusCode2[HttpStatusCode2["Accepted"] = 202] = "Accepted";
|
|
826
|
-
HttpStatusCode2[HttpStatusCode2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
827
|
-
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
|
|
828
|
-
HttpStatusCode2[HttpStatusCode2["ResetContent"] = 205] = "ResetContent";
|
|
829
|
-
HttpStatusCode2[HttpStatusCode2["PartialContent"] = 206] = "PartialContent";
|
|
830
|
-
HttpStatusCode2[HttpStatusCode2["MultiStatus"] = 207] = "MultiStatus";
|
|
831
|
-
HttpStatusCode2[HttpStatusCode2["AlreadyReported"] = 208] = "AlreadyReported";
|
|
832
|
-
HttpStatusCode2[HttpStatusCode2["ImUsed"] = 226] = "ImUsed";
|
|
833
|
-
HttpStatusCode2[HttpStatusCode2["MultipleChoices"] = 300] = "MultipleChoices";
|
|
834
|
-
HttpStatusCode2[HttpStatusCode2["MovedPermanently"] = 301] = "MovedPermanently";
|
|
835
|
-
HttpStatusCode2[HttpStatusCode2["Found"] = 302] = "Found";
|
|
836
|
-
HttpStatusCode2[HttpStatusCode2["SeeOther"] = 303] = "SeeOther";
|
|
837
|
-
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
|
|
838
|
-
HttpStatusCode2[HttpStatusCode2["UseProxy"] = 305] = "UseProxy";
|
|
839
|
-
HttpStatusCode2[HttpStatusCode2["Unused"] = 306] = "Unused";
|
|
840
|
-
HttpStatusCode2[HttpStatusCode2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
841
|
-
HttpStatusCode2[HttpStatusCode2["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
842
|
-
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
|
|
843
|
-
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
|
|
844
|
-
HttpStatusCode2[HttpStatusCode2["PaymentRequired"] = 402] = "PaymentRequired";
|
|
845
|
-
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
|
|
846
|
-
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
|
|
847
|
-
HttpStatusCode2[HttpStatusCode2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
848
|
-
HttpStatusCode2[HttpStatusCode2["NotAcceptable"] = 406] = "NotAcceptable";
|
|
849
|
-
HttpStatusCode2[HttpStatusCode2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
850
|
-
HttpStatusCode2[HttpStatusCode2["RequestTimeout"] = 408] = "RequestTimeout";
|
|
851
|
-
HttpStatusCode2[HttpStatusCode2["Conflict"] = 409] = "Conflict";
|
|
852
|
-
HttpStatusCode2[HttpStatusCode2["Gone"] = 410] = "Gone";
|
|
853
|
-
HttpStatusCode2[HttpStatusCode2["LengthRequired"] = 411] = "LengthRequired";
|
|
854
|
-
HttpStatusCode2[HttpStatusCode2["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
855
|
-
HttpStatusCode2[HttpStatusCode2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
856
|
-
HttpStatusCode2[HttpStatusCode2["UriTooLong"] = 414] = "UriTooLong";
|
|
857
|
-
HttpStatusCode2[HttpStatusCode2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
858
|
-
HttpStatusCode2[HttpStatusCode2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
859
|
-
HttpStatusCode2[HttpStatusCode2["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
860
|
-
HttpStatusCode2[HttpStatusCode2["ImATeapot"] = 418] = "ImATeapot";
|
|
861
|
-
HttpStatusCode2[HttpStatusCode2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
862
|
-
HttpStatusCode2[HttpStatusCode2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
863
|
-
HttpStatusCode2[HttpStatusCode2["Locked"] = 423] = "Locked";
|
|
864
|
-
HttpStatusCode2[HttpStatusCode2["FailedDependency"] = 424] = "FailedDependency";
|
|
865
|
-
HttpStatusCode2[HttpStatusCode2["TooEarly"] = 425] = "TooEarly";
|
|
866
|
-
HttpStatusCode2[HttpStatusCode2["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
867
|
-
HttpStatusCode2[HttpStatusCode2["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
868
|
-
HttpStatusCode2[HttpStatusCode2["TooManyRequests"] = 429] = "TooManyRequests";
|
|
869
|
-
HttpStatusCode2[HttpStatusCode2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
870
|
-
HttpStatusCode2[HttpStatusCode2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
871
|
-
HttpStatusCode2[HttpStatusCode2["InternalServerError"] = 500] = "InternalServerError";
|
|
872
|
-
HttpStatusCode2[HttpStatusCode2["NotImplemented"] = 501] = "NotImplemented";
|
|
873
|
-
HttpStatusCode2[HttpStatusCode2["BadGateway"] = 502] = "BadGateway";
|
|
874
|
-
HttpStatusCode2[HttpStatusCode2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
875
|
-
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
876
|
-
HttpStatusCode2[HttpStatusCode2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
|
|
877
|
-
HttpStatusCode2[HttpStatusCode2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
878
|
-
HttpStatusCode2[HttpStatusCode2["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
879
|
-
HttpStatusCode2[HttpStatusCode2["LoopDetected"] = 508] = "LoopDetected";
|
|
880
|
-
HttpStatusCode2[HttpStatusCode2["NotExtended"] = 510] = "NotExtended";
|
|
881
|
-
HttpStatusCode2[HttpStatusCode2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
882
|
-
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
883
|
-
function addBody(options, body) {
|
|
884
|
-
return {
|
|
885
|
-
body,
|
|
886
|
-
headers: options.headers,
|
|
887
|
-
context: options.context,
|
|
888
|
-
observe: options.observe,
|
|
889
|
-
params: options.params,
|
|
890
|
-
reportProgress: options.reportProgress,
|
|
891
|
-
responseType: options.responseType,
|
|
892
|
-
withCredentials: options.withCredentials,
|
|
893
|
-
transferCache: options.transferCache
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
var HttpClient = class _HttpClient {
|
|
897
|
-
constructor(handler) {
|
|
898
|
-
this.handler = handler;
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* Constructs an observable for a generic HTTP request that, when subscribed,
|
|
902
|
-
* fires the request through the chain of registered interceptors and on to the
|
|
903
|
-
* server.
|
|
904
|
-
*
|
|
905
|
-
* You can pass an `HttpRequest` directly as the only parameter. In this case,
|
|
906
|
-
* the call returns an observable of the raw `HttpEvent` stream.
|
|
907
|
-
*
|
|
908
|
-
* Alternatively you can pass an HTTP method as the first parameter,
|
|
909
|
-
* a URL string as the second, and an options hash containing the request body as the third.
|
|
910
|
-
* See `addBody()`. In this case, the specified `responseType` and `observe` options determine the
|
|
911
|
-
* type of returned observable.
|
|
912
|
-
* * The `responseType` value determines how a successful response body is parsed.
|
|
913
|
-
* * If `responseType` is the default `json`, you can pass a type interface for the resulting
|
|
914
|
-
* object as a type parameter to the call.
|
|
915
|
-
*
|
|
916
|
-
* The `observe` value determines the return type, according to what you are interested in
|
|
917
|
-
* observing.
|
|
918
|
-
* * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including
|
|
919
|
-
* progress events by default.
|
|
920
|
-
* * An `observe` value of response returns an observable of `HttpResponse<T>`,
|
|
921
|
-
* where the `T` parameter depends on the `responseType` and any optionally provided type
|
|
922
|
-
* parameter.
|
|
923
|
-
* * An `observe` value of body returns an observable of `<T>` with the same `T` body type.
|
|
924
|
-
*
|
|
925
|
-
*/
|
|
926
|
-
request(first, url, options = {}) {
|
|
927
|
-
let req;
|
|
928
|
-
if (first instanceof HttpRequest) {
|
|
929
|
-
req = first;
|
|
930
|
-
} else {
|
|
931
|
-
let headers = void 0;
|
|
932
|
-
if (options.headers instanceof HttpHeaders) {
|
|
933
|
-
headers = options.headers;
|
|
934
|
-
} else {
|
|
935
|
-
headers = new HttpHeaders(options.headers);
|
|
936
|
-
}
|
|
937
|
-
let params = void 0;
|
|
938
|
-
if (!!options.params) {
|
|
939
|
-
if (options.params instanceof HttpParams) {
|
|
940
|
-
params = options.params;
|
|
941
|
-
} else {
|
|
942
|
-
params = new HttpParams({
|
|
943
|
-
fromObject: options.params
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
req = new HttpRequest(first, url, options.body !== void 0 ? options.body : null, {
|
|
948
|
-
headers,
|
|
949
|
-
context: options.context,
|
|
950
|
-
params,
|
|
951
|
-
reportProgress: options.reportProgress,
|
|
952
|
-
// By default, JSON is assumed to be returned for all calls.
|
|
953
|
-
responseType: options.responseType || "json",
|
|
954
|
-
withCredentials: options.withCredentials,
|
|
955
|
-
transferCache: options.transferCache
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
const events$ = of(req).pipe(concatMap((req2) => this.handler.handle(req2)));
|
|
959
|
-
if (first instanceof HttpRequest || options.observe === "events") {
|
|
960
|
-
return events$;
|
|
961
|
-
}
|
|
962
|
-
const res$ = events$.pipe(filter((event) => event instanceof HttpResponse));
|
|
963
|
-
switch (options.observe || "body") {
|
|
964
|
-
case "body":
|
|
965
|
-
switch (req.responseType) {
|
|
966
|
-
case "arraybuffer":
|
|
967
|
-
return res$.pipe(map((res) => {
|
|
968
|
-
if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
|
|
969
|
-
throw new Error("Response is not an ArrayBuffer.");
|
|
970
|
-
}
|
|
971
|
-
return res.body;
|
|
972
|
-
}));
|
|
973
|
-
case "blob":
|
|
974
|
-
return res$.pipe(map((res) => {
|
|
975
|
-
if (res.body !== null && !(res.body instanceof Blob)) {
|
|
976
|
-
throw new Error("Response is not a Blob.");
|
|
977
|
-
}
|
|
978
|
-
return res.body;
|
|
979
|
-
}));
|
|
980
|
-
case "text":
|
|
981
|
-
return res$.pipe(map((res) => {
|
|
982
|
-
if (res.body !== null && typeof res.body !== "string") {
|
|
983
|
-
throw new Error("Response is not a string.");
|
|
984
|
-
}
|
|
985
|
-
return res.body;
|
|
986
|
-
}));
|
|
987
|
-
case "json":
|
|
988
|
-
default:
|
|
989
|
-
return res$.pipe(map((res) => res.body));
|
|
990
|
-
}
|
|
991
|
-
case "response":
|
|
992
|
-
return res$;
|
|
993
|
-
default:
|
|
994
|
-
throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Constructs an observable that, when subscribed, causes the configured
|
|
999
|
-
* `DELETE` request to execute on the server. See the individual overloads for
|
|
1000
|
-
* details on the return type.
|
|
1001
|
-
*
|
|
1002
|
-
* @param url The endpoint URL.
|
|
1003
|
-
* @param options The HTTP options to send with the request.
|
|
1004
|
-
*
|
|
1005
|
-
*/
|
|
1006
|
-
delete(url, options = {}) {
|
|
1007
|
-
return this.request("DELETE", url, options);
|
|
1008
|
-
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Constructs an observable that, when subscribed, causes the configured
|
|
1011
|
-
* `GET` request to execute on the server. See the individual overloads for
|
|
1012
|
-
* details on the return type.
|
|
1013
|
-
*/
|
|
1014
|
-
get(url, options = {}) {
|
|
1015
|
-
return this.request("GET", url, options);
|
|
1016
|
-
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Constructs an observable that, when subscribed, causes the configured
|
|
1019
|
-
* `HEAD` request to execute on the server. The `HEAD` method returns
|
|
1020
|
-
* meta information about the resource without transferring the
|
|
1021
|
-
* resource itself. See the individual overloads for
|
|
1022
|
-
* details on the return type.
|
|
1023
|
-
*/
|
|
1024
|
-
head(url, options = {}) {
|
|
1025
|
-
return this.request("HEAD", url, options);
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Constructs an `Observable` that, when subscribed, causes a request with the special method
|
|
1029
|
-
* `JSONP` to be dispatched via the interceptor pipeline.
|
|
1030
|
-
* The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain
|
|
1031
|
-
* API endpoints that don't support newer,
|
|
1032
|
-
* and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol.
|
|
1033
|
-
* JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the
|
|
1034
|
-
* requests even if the API endpoint is not located on the same domain (origin) as the client-side
|
|
1035
|
-
* application making the request.
|
|
1036
|
-
* The endpoint API must support JSONP callback for JSONP requests to work.
|
|
1037
|
-
* The resource API returns the JSON response wrapped in a callback function.
|
|
1038
|
-
* You can pass the callback function name as one of the query parameters.
|
|
1039
|
-
* Note that JSONP requests can only be used with `GET` requests.
|
|
1040
|
-
*
|
|
1041
|
-
* @param url The resource URL.
|
|
1042
|
-
* @param callbackParam The callback function name.
|
|
1043
|
-
*
|
|
1044
|
-
*/
|
|
1045
|
-
jsonp(url, callbackParam) {
|
|
1046
|
-
return this.request("JSONP", url, {
|
|
1047
|
-
params: new HttpParams().append(callbackParam, "JSONP_CALLBACK"),
|
|
1048
|
-
observe: "body",
|
|
1049
|
-
responseType: "json"
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Constructs an `Observable` that, when subscribed, causes the configured
|
|
1054
|
-
* `OPTIONS` request to execute on the server. This method allows the client
|
|
1055
|
-
* to determine the supported HTTP methods and other capabilities of an endpoint,
|
|
1056
|
-
* without implying a resource action. See the individual overloads for
|
|
1057
|
-
* details on the return type.
|
|
1058
|
-
*/
|
|
1059
|
-
options(url, options = {}) {
|
|
1060
|
-
return this.request("OPTIONS", url, options);
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Constructs an observable that, when subscribed, causes the configured
|
|
1064
|
-
* `PATCH` request to execute on the server. See the individual overloads for
|
|
1065
|
-
* details on the return type.
|
|
1066
|
-
*/
|
|
1067
|
-
patch(url, body, options = {}) {
|
|
1068
|
-
return this.request("PATCH", url, addBody(options, body));
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Constructs an observable that, when subscribed, causes the configured
|
|
1072
|
-
* `POST` request to execute on the server. The server responds with the location of
|
|
1073
|
-
* the replaced resource. See the individual overloads for
|
|
1074
|
-
* details on the return type.
|
|
1075
|
-
*/
|
|
1076
|
-
post(url, body, options = {}) {
|
|
1077
|
-
return this.request("POST", url, addBody(options, body));
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Constructs an observable that, when subscribed, causes the configured
|
|
1081
|
-
* `PUT` request to execute on the server. The `PUT` method replaces an existing resource
|
|
1082
|
-
* with a new set of values.
|
|
1083
|
-
* See the individual overloads for details on the return type.
|
|
1084
|
-
*/
|
|
1085
|
-
put(url, body, options = {}) {
|
|
1086
|
-
return this.request("PUT", url, addBody(options, body));
|
|
1087
|
-
}
|
|
1088
|
-
static {
|
|
1089
|
-
this.ɵfac = function HttpClient_Factory(__ngFactoryType__) {
|
|
1090
|
-
return new (__ngFactoryType__ || _HttpClient)(ɵɵinject(HttpHandler));
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1093
|
-
static {
|
|
1094
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1095
|
-
token: _HttpClient,
|
|
1096
|
-
factory: _HttpClient.ɵfac
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
};
|
|
1100
|
-
(() => {
|
|
1101
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClient, [{
|
|
1102
|
-
type: Injectable
|
|
1103
|
-
}], () => [{
|
|
1104
|
-
type: HttpHandler
|
|
1105
|
-
}], null);
|
|
1106
|
-
})();
|
|
1107
|
-
var XSSI_PREFIX$1 = /^\)\]\}',?\n/;
|
|
1108
|
-
var REQUEST_URL_HEADER = `X-Request-URL`;
|
|
1109
|
-
function getResponseUrl$1(response) {
|
|
1110
|
-
if (response.url) {
|
|
1111
|
-
return response.url;
|
|
1112
|
-
}
|
|
1113
|
-
const xRequestUrl = REQUEST_URL_HEADER.toLocaleLowerCase();
|
|
1114
|
-
return response.headers.get(xRequestUrl);
|
|
1115
|
-
}
|
|
1116
|
-
var FetchBackend = class _FetchBackend {
|
|
1117
|
-
constructor() {
|
|
1118
|
-
this.fetchImpl = inject(FetchFactory, {
|
|
1119
|
-
optional: true
|
|
1120
|
-
})?.fetch ?? ((...args) => globalThis.fetch(...args));
|
|
1121
|
-
this.ngZone = inject(NgZone);
|
|
1122
|
-
}
|
|
1123
|
-
handle(request) {
|
|
1124
|
-
return new Observable((observer) => {
|
|
1125
|
-
const aborter = new AbortController();
|
|
1126
|
-
this.doRequest(request, aborter.signal, observer).then(noop, (error) => observer.error(new HttpErrorResponse({
|
|
1127
|
-
error
|
|
1128
|
-
})));
|
|
1129
|
-
return () => aborter.abort();
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
doRequest(request, signal, observer) {
|
|
1133
|
-
return __async(this, null, function* () {
|
|
1134
|
-
const init = this.createRequestInit(request);
|
|
1135
|
-
let response;
|
|
1136
|
-
try {
|
|
1137
|
-
const fetchPromise = this.ngZone.runOutsideAngular(() => this.fetchImpl(request.urlWithParams, __spreadValues({
|
|
1138
|
-
signal
|
|
1139
|
-
}, init)));
|
|
1140
|
-
silenceSuperfluousUnhandledPromiseRejection(fetchPromise);
|
|
1141
|
-
observer.next({
|
|
1142
|
-
type: HttpEventType.Sent
|
|
1143
|
-
});
|
|
1144
|
-
response = yield fetchPromise;
|
|
1145
|
-
} catch (error) {
|
|
1146
|
-
observer.error(new HttpErrorResponse({
|
|
1147
|
-
error,
|
|
1148
|
-
status: error.status ?? 0,
|
|
1149
|
-
statusText: error.statusText,
|
|
1150
|
-
url: request.urlWithParams,
|
|
1151
|
-
headers: error.headers
|
|
1152
|
-
}));
|
|
1153
|
-
return;
|
|
1154
|
-
}
|
|
1155
|
-
const headers = new HttpHeaders(response.headers);
|
|
1156
|
-
const statusText = response.statusText;
|
|
1157
|
-
const url = getResponseUrl$1(response) ?? request.urlWithParams;
|
|
1158
|
-
let status = response.status;
|
|
1159
|
-
let body = null;
|
|
1160
|
-
if (request.reportProgress) {
|
|
1161
|
-
observer.next(new HttpHeaderResponse({
|
|
1162
|
-
headers,
|
|
1163
|
-
status,
|
|
1164
|
-
statusText,
|
|
1165
|
-
url
|
|
1166
|
-
}));
|
|
1167
|
-
}
|
|
1168
|
-
if (response.body) {
|
|
1169
|
-
const contentLength = response.headers.get("content-length");
|
|
1170
|
-
const chunks = [];
|
|
1171
|
-
const reader = response.body.getReader();
|
|
1172
|
-
let receivedLength = 0;
|
|
1173
|
-
let decoder;
|
|
1174
|
-
let partialText;
|
|
1175
|
-
const reqZone = typeof Zone !== "undefined" && Zone.current;
|
|
1176
|
-
yield this.ngZone.runOutsideAngular(() => __async(this, null, function* () {
|
|
1177
|
-
while (true) {
|
|
1178
|
-
const {
|
|
1179
|
-
done,
|
|
1180
|
-
value
|
|
1181
|
-
} = yield reader.read();
|
|
1182
|
-
if (done) {
|
|
1183
|
-
break;
|
|
1184
|
-
}
|
|
1185
|
-
chunks.push(value);
|
|
1186
|
-
receivedLength += value.length;
|
|
1187
|
-
if (request.reportProgress) {
|
|
1188
|
-
partialText = request.responseType === "text" ? (partialText ?? "") + (decoder ??= new TextDecoder()).decode(value, {
|
|
1189
|
-
stream: true
|
|
1190
|
-
}) : void 0;
|
|
1191
|
-
const reportProgress = () => observer.next({
|
|
1192
|
-
type: HttpEventType.DownloadProgress,
|
|
1193
|
-
total: contentLength ? +contentLength : void 0,
|
|
1194
|
-
loaded: receivedLength,
|
|
1195
|
-
partialText
|
|
1196
|
-
});
|
|
1197
|
-
reqZone ? reqZone.run(reportProgress) : reportProgress();
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
}));
|
|
1201
|
-
const chunksAll = this.concatChunks(chunks, receivedLength);
|
|
1202
|
-
try {
|
|
1203
|
-
const contentType = response.headers.get("Content-Type") ?? "";
|
|
1204
|
-
body = this.parseBody(request, chunksAll, contentType);
|
|
1205
|
-
} catch (error) {
|
|
1206
|
-
observer.error(new HttpErrorResponse({
|
|
1207
|
-
error,
|
|
1208
|
-
headers: new HttpHeaders(response.headers),
|
|
1209
|
-
status: response.status,
|
|
1210
|
-
statusText: response.statusText,
|
|
1211
|
-
url: getResponseUrl$1(response) ?? request.urlWithParams
|
|
1212
|
-
}));
|
|
1213
|
-
return;
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
if (status === 0) {
|
|
1217
|
-
status = body ? HTTP_STATUS_CODE_OK : 0;
|
|
1218
|
-
}
|
|
1219
|
-
const ok = status >= 200 && status < 300;
|
|
1220
|
-
if (ok) {
|
|
1221
|
-
observer.next(new HttpResponse({
|
|
1222
|
-
body,
|
|
1223
|
-
headers,
|
|
1224
|
-
status,
|
|
1225
|
-
statusText,
|
|
1226
|
-
url
|
|
1227
|
-
}));
|
|
1228
|
-
observer.complete();
|
|
1229
|
-
} else {
|
|
1230
|
-
observer.error(new HttpErrorResponse({
|
|
1231
|
-
error: body,
|
|
1232
|
-
headers,
|
|
1233
|
-
status,
|
|
1234
|
-
statusText,
|
|
1235
|
-
url
|
|
1236
|
-
}));
|
|
1237
|
-
}
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
|
-
parseBody(request, binContent, contentType) {
|
|
1241
|
-
switch (request.responseType) {
|
|
1242
|
-
case "json":
|
|
1243
|
-
const text = new TextDecoder().decode(binContent).replace(XSSI_PREFIX$1, "");
|
|
1244
|
-
return text === "" ? null : JSON.parse(text);
|
|
1245
|
-
case "text":
|
|
1246
|
-
return new TextDecoder().decode(binContent);
|
|
1247
|
-
case "blob":
|
|
1248
|
-
return new Blob([binContent], {
|
|
1249
|
-
type: contentType
|
|
1250
|
-
});
|
|
1251
|
-
case "arraybuffer":
|
|
1252
|
-
return binContent.buffer;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
createRequestInit(req) {
|
|
1256
|
-
const headers = {};
|
|
1257
|
-
const credentials = req.withCredentials ? "include" : void 0;
|
|
1258
|
-
req.headers.forEach((name, values) => headers[name] = values.join(","));
|
|
1259
|
-
if (!req.headers.has("Accept")) {
|
|
1260
|
-
headers["Accept"] = "application/json, text/plain, */*";
|
|
1261
|
-
}
|
|
1262
|
-
if (!req.headers.has("Content-Type")) {
|
|
1263
|
-
const detectedType = req.detectContentTypeHeader();
|
|
1264
|
-
if (detectedType !== null) {
|
|
1265
|
-
headers["Content-Type"] = detectedType;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
return {
|
|
1269
|
-
body: req.serializeBody(),
|
|
1270
|
-
method: req.method,
|
|
1271
|
-
headers,
|
|
1272
|
-
credentials
|
|
1273
|
-
};
|
|
1274
|
-
}
|
|
1275
|
-
concatChunks(chunks, totalLength) {
|
|
1276
|
-
const chunksAll = new Uint8Array(totalLength);
|
|
1277
|
-
let position = 0;
|
|
1278
|
-
for (const chunk of chunks) {
|
|
1279
|
-
chunksAll.set(chunk, position);
|
|
1280
|
-
position += chunk.length;
|
|
1281
|
-
}
|
|
1282
|
-
return chunksAll;
|
|
1283
|
-
}
|
|
1284
|
-
static {
|
|
1285
|
-
this.ɵfac = function FetchBackend_Factory(__ngFactoryType__) {
|
|
1286
|
-
return new (__ngFactoryType__ || _FetchBackend)();
|
|
1287
|
-
};
|
|
1288
|
-
}
|
|
1289
|
-
static {
|
|
1290
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1291
|
-
token: _FetchBackend,
|
|
1292
|
-
factory: _FetchBackend.ɵfac
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
};
|
|
1296
|
-
(() => {
|
|
1297
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FetchBackend, [{
|
|
1298
|
-
type: Injectable
|
|
1299
|
-
}], null, null);
|
|
1300
|
-
})();
|
|
1301
|
-
var FetchFactory = class {
|
|
1302
|
-
};
|
|
1303
|
-
function noop() {
|
|
1304
|
-
}
|
|
1305
|
-
function silenceSuperfluousUnhandledPromiseRejection(promise) {
|
|
1306
|
-
promise.then(noop, noop);
|
|
1307
|
-
}
|
|
1308
|
-
function interceptorChainEndFn(req, finalHandlerFn) {
|
|
1309
|
-
return finalHandlerFn(req);
|
|
1310
|
-
}
|
|
1311
|
-
function adaptLegacyInterceptorToChain(chainTailFn, interceptor) {
|
|
1312
|
-
return (initialRequest, finalHandlerFn) => interceptor.intercept(initialRequest, {
|
|
1313
|
-
handle: (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)
|
|
1314
|
-
});
|
|
1315
|
-
}
|
|
1316
|
-
function chainedInterceptorFn(chainTailFn, interceptorFn, injector) {
|
|
1317
|
-
return (initialRequest, finalHandlerFn) => runInInjectionContext(injector, () => interceptorFn(initialRequest, (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)));
|
|
1318
|
-
}
|
|
1319
|
-
var HTTP_INTERCEPTORS = new InjectionToken(ngDevMode ? "HTTP_INTERCEPTORS" : "");
|
|
1320
|
-
var HTTP_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? "HTTP_INTERCEPTOR_FNS" : "");
|
|
1321
|
-
var HTTP_ROOT_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? "HTTP_ROOT_INTERCEPTOR_FNS" : "");
|
|
1322
|
-
var REQUESTS_CONTRIBUTE_TO_STABILITY = new InjectionToken(ngDevMode ? "REQUESTS_CONTRIBUTE_TO_STABILITY" : "", {
|
|
1323
|
-
providedIn: "root",
|
|
1324
|
-
factory: () => true
|
|
1325
|
-
});
|
|
1326
|
-
function legacyInterceptorFnFactory() {
|
|
1327
|
-
let chain = null;
|
|
1328
|
-
return (req, handler) => {
|
|
1329
|
-
if (chain === null) {
|
|
1330
|
-
const interceptors = inject(HTTP_INTERCEPTORS, {
|
|
1331
|
-
optional: true
|
|
1332
|
-
}) ?? [];
|
|
1333
|
-
chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);
|
|
1334
|
-
}
|
|
1335
|
-
const pendingTasks = inject(PendingTasks);
|
|
1336
|
-
const contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);
|
|
1337
|
-
if (contributeToStability) {
|
|
1338
|
-
const taskId = pendingTasks.add();
|
|
1339
|
-
return chain(req, handler).pipe(finalize(() => pendingTasks.remove(taskId)));
|
|
1340
|
-
} else {
|
|
1341
|
-
return chain(req, handler);
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
|
-
}
|
|
1345
|
-
var fetchBackendWarningDisplayed = false;
|
|
1346
|
-
var HttpInterceptorHandler = class _HttpInterceptorHandler extends HttpHandler {
|
|
1347
|
-
constructor(backend, injector) {
|
|
1348
|
-
super();
|
|
1349
|
-
this.backend = backend;
|
|
1350
|
-
this.injector = injector;
|
|
1351
|
-
this.chain = null;
|
|
1352
|
-
this.pendingTasks = inject(PendingTasks);
|
|
1353
|
-
this.contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);
|
|
1354
|
-
if ((typeof ngDevMode === "undefined" || ngDevMode) && !fetchBackendWarningDisplayed) {
|
|
1355
|
-
const isServer = isPlatformServer(injector.get(PLATFORM_ID));
|
|
1356
|
-
if (isServer && !(this.backend instanceof FetchBackend)) {
|
|
1357
|
-
fetchBackendWarningDisplayed = true;
|
|
1358
|
-
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."));
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
handle(initialRequest) {
|
|
1363
|
-
if (this.chain === null) {
|
|
1364
|
-
const dedupedInterceptorFns = Array.from(/* @__PURE__ */ new Set([...this.injector.get(HTTP_INTERCEPTOR_FNS), ...this.injector.get(HTTP_ROOT_INTERCEPTOR_FNS, [])]));
|
|
1365
|
-
this.chain = dedupedInterceptorFns.reduceRight((nextSequencedFn, interceptorFn) => chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector), interceptorChainEndFn);
|
|
1366
|
-
}
|
|
1367
|
-
if (this.contributeToStability) {
|
|
1368
|
-
const taskId = this.pendingTasks.add();
|
|
1369
|
-
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest)).pipe(finalize(() => this.pendingTasks.remove(taskId)));
|
|
1370
|
-
} else {
|
|
1371
|
-
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
static {
|
|
1375
|
-
this.ɵfac = function HttpInterceptorHandler_Factory(__ngFactoryType__) {
|
|
1376
|
-
return new (__ngFactoryType__ || _HttpInterceptorHandler)(ɵɵinject(HttpBackend), ɵɵinject(EnvironmentInjector));
|
|
1377
|
-
};
|
|
1378
|
-
}
|
|
1379
|
-
static {
|
|
1380
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1381
|
-
token: _HttpInterceptorHandler,
|
|
1382
|
-
factory: _HttpInterceptorHandler.ɵfac
|
|
1383
|
-
});
|
|
1384
|
-
}
|
|
1385
|
-
};
|
|
1386
|
-
(() => {
|
|
1387
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpInterceptorHandler, [{
|
|
1388
|
-
type: Injectable
|
|
1389
|
-
}], () => [{
|
|
1390
|
-
type: HttpBackend
|
|
1391
|
-
}, {
|
|
1392
|
-
type: EnvironmentInjector
|
|
1393
|
-
}], null);
|
|
1394
|
-
})();
|
|
1395
|
-
var nextRequestId = 0;
|
|
1396
|
-
var foreignDocument;
|
|
1397
|
-
var JSONP_ERR_NO_CALLBACK = "JSONP injected script did not invoke callback.";
|
|
1398
|
-
var JSONP_ERR_WRONG_METHOD = "JSONP requests must use JSONP request method.";
|
|
1399
|
-
var JSONP_ERR_WRONG_RESPONSE_TYPE = "JSONP requests must use Json response type.";
|
|
1400
|
-
var JSONP_ERR_HEADERS_NOT_SUPPORTED = "JSONP requests do not support headers.";
|
|
1401
|
-
var JsonpCallbackContext = class {
|
|
1402
|
-
};
|
|
1403
|
-
function jsonpCallbackContext() {
|
|
1404
|
-
if (typeof window === "object") {
|
|
1405
|
-
return window;
|
|
1406
|
-
}
|
|
1407
|
-
return {};
|
|
1408
|
-
}
|
|
1409
|
-
var JsonpClientBackend = class _JsonpClientBackend {
|
|
1410
|
-
constructor(callbackMap, document) {
|
|
1411
|
-
this.callbackMap = callbackMap;
|
|
1412
|
-
this.document = document;
|
|
1413
|
-
this.resolvedPromise = Promise.resolve();
|
|
1414
|
-
}
|
|
1415
|
-
/**
|
|
1416
|
-
* Get the name of the next callback method, by incrementing the global `nextRequestId`.
|
|
1417
|
-
*/
|
|
1418
|
-
nextCallback() {
|
|
1419
|
-
return `ng_jsonp_callback_${nextRequestId++}`;
|
|
1420
|
-
}
|
|
1421
|
-
/**
|
|
1422
|
-
* Processes a JSONP request and returns an event stream of the results.
|
|
1423
|
-
* @param req The request object.
|
|
1424
|
-
* @returns An observable of the response events.
|
|
1425
|
-
*
|
|
1426
|
-
*/
|
|
1427
|
-
handle(req) {
|
|
1428
|
-
if (req.method !== "JSONP") {
|
|
1429
|
-
throw new Error(JSONP_ERR_WRONG_METHOD);
|
|
1430
|
-
} else if (req.responseType !== "json") {
|
|
1431
|
-
throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE);
|
|
1432
|
-
}
|
|
1433
|
-
if (req.headers.keys().length > 0) {
|
|
1434
|
-
throw new Error(JSONP_ERR_HEADERS_NOT_SUPPORTED);
|
|
1435
|
-
}
|
|
1436
|
-
return new Observable((observer) => {
|
|
1437
|
-
const callback = this.nextCallback();
|
|
1438
|
-
const url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`);
|
|
1439
|
-
const node = this.document.createElement("script");
|
|
1440
|
-
node.src = url;
|
|
1441
|
-
let body = null;
|
|
1442
|
-
let finished = false;
|
|
1443
|
-
this.callbackMap[callback] = (data) => {
|
|
1444
|
-
delete this.callbackMap[callback];
|
|
1445
|
-
body = data;
|
|
1446
|
-
finished = true;
|
|
1447
|
-
};
|
|
1448
|
-
const cleanup = () => {
|
|
1449
|
-
node.removeEventListener("load", onLoad);
|
|
1450
|
-
node.removeEventListener("error", onError);
|
|
1451
|
-
node.remove();
|
|
1452
|
-
delete this.callbackMap[callback];
|
|
1453
|
-
};
|
|
1454
|
-
const onLoad = (event) => {
|
|
1455
|
-
this.resolvedPromise.then(() => {
|
|
1456
|
-
cleanup();
|
|
1457
|
-
if (!finished) {
|
|
1458
|
-
observer.error(new HttpErrorResponse({
|
|
1459
|
-
url,
|
|
1460
|
-
status: 0,
|
|
1461
|
-
statusText: "JSONP Error",
|
|
1462
|
-
error: new Error(JSONP_ERR_NO_CALLBACK)
|
|
1463
|
-
}));
|
|
1464
|
-
return;
|
|
1465
|
-
}
|
|
1466
|
-
observer.next(new HttpResponse({
|
|
1467
|
-
body,
|
|
1468
|
-
status: HTTP_STATUS_CODE_OK,
|
|
1469
|
-
statusText: "OK",
|
|
1470
|
-
url
|
|
1471
|
-
}));
|
|
1472
|
-
observer.complete();
|
|
1473
|
-
});
|
|
1474
|
-
};
|
|
1475
|
-
const onError = (error) => {
|
|
1476
|
-
cleanup();
|
|
1477
|
-
observer.error(new HttpErrorResponse({
|
|
1478
|
-
error,
|
|
1479
|
-
status: 0,
|
|
1480
|
-
statusText: "JSONP Error",
|
|
1481
|
-
url
|
|
1482
|
-
}));
|
|
1483
|
-
};
|
|
1484
|
-
node.addEventListener("load", onLoad);
|
|
1485
|
-
node.addEventListener("error", onError);
|
|
1486
|
-
this.document.body.appendChild(node);
|
|
1487
|
-
observer.next({
|
|
1488
|
-
type: HttpEventType.Sent
|
|
1489
|
-
});
|
|
1490
|
-
return () => {
|
|
1491
|
-
if (!finished) {
|
|
1492
|
-
this.removeListeners(node);
|
|
1493
|
-
}
|
|
1494
|
-
cleanup();
|
|
1495
|
-
};
|
|
1496
|
-
});
|
|
1497
|
-
}
|
|
1498
|
-
removeListeners(script) {
|
|
1499
|
-
foreignDocument ??= this.document.implementation.createHTMLDocument();
|
|
1500
|
-
foreignDocument.adoptNode(script);
|
|
1501
|
-
}
|
|
1502
|
-
static {
|
|
1503
|
-
this.ɵfac = function JsonpClientBackend_Factory(__ngFactoryType__) {
|
|
1504
|
-
return new (__ngFactoryType__ || _JsonpClientBackend)(ɵɵinject(JsonpCallbackContext), ɵɵinject(DOCUMENT));
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1507
|
-
static {
|
|
1508
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1509
|
-
token: _JsonpClientBackend,
|
|
1510
|
-
factory: _JsonpClientBackend.ɵfac
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
(() => {
|
|
1515
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpClientBackend, [{
|
|
1516
|
-
type: Injectable
|
|
1517
|
-
}], () => [{
|
|
1518
|
-
type: JsonpCallbackContext
|
|
1519
|
-
}, {
|
|
1520
|
-
type: void 0,
|
|
1521
|
-
decorators: [{
|
|
1522
|
-
type: Inject,
|
|
1523
|
-
args: [DOCUMENT]
|
|
1524
|
-
}]
|
|
1525
|
-
}], null);
|
|
1526
|
-
})();
|
|
1527
|
-
function jsonpInterceptorFn(req, next) {
|
|
1528
|
-
if (req.method === "JSONP") {
|
|
1529
|
-
return inject(JsonpClientBackend).handle(req);
|
|
1530
|
-
}
|
|
1531
|
-
return next(req);
|
|
1532
|
-
}
|
|
1533
|
-
var JsonpInterceptor = class _JsonpInterceptor {
|
|
1534
|
-
constructor(injector) {
|
|
1535
|
-
this.injector = injector;
|
|
1536
|
-
}
|
|
1537
|
-
/**
|
|
1538
|
-
* Identifies and handles a given JSONP request.
|
|
1539
|
-
* @param initialRequest The outgoing request object to handle.
|
|
1540
|
-
* @param next The next interceptor in the chain, or the backend
|
|
1541
|
-
* if no interceptors remain in the chain.
|
|
1542
|
-
* @returns An observable of the event stream.
|
|
1543
|
-
*/
|
|
1544
|
-
intercept(initialRequest, next) {
|
|
1545
|
-
return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
1546
|
-
}
|
|
1547
|
-
static {
|
|
1548
|
-
this.ɵfac = function JsonpInterceptor_Factory(__ngFactoryType__) {
|
|
1549
|
-
return new (__ngFactoryType__ || _JsonpInterceptor)(ɵɵinject(EnvironmentInjector));
|
|
1550
|
-
};
|
|
1551
|
-
}
|
|
1552
|
-
static {
|
|
1553
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1554
|
-
token: _JsonpInterceptor,
|
|
1555
|
-
factory: _JsonpInterceptor.ɵfac
|
|
1556
|
-
});
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
(() => {
|
|
1560
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpInterceptor, [{
|
|
1561
|
-
type: Injectable
|
|
1562
|
-
}], () => [{
|
|
1563
|
-
type: EnvironmentInjector
|
|
1564
|
-
}], null);
|
|
1565
|
-
})();
|
|
1566
|
-
var XSSI_PREFIX = /^\)\]\}',?\n/;
|
|
1567
|
-
function getResponseUrl(xhr) {
|
|
1568
|
-
if ("responseURL" in xhr && xhr.responseURL) {
|
|
1569
|
-
return xhr.responseURL;
|
|
1570
|
-
}
|
|
1571
|
-
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
|
|
1572
|
-
return xhr.getResponseHeader("X-Request-URL");
|
|
1573
|
-
}
|
|
1574
|
-
return null;
|
|
1575
|
-
}
|
|
1576
|
-
var HttpXhrBackend = class _HttpXhrBackend {
|
|
1577
|
-
constructor(xhrFactory) {
|
|
1578
|
-
this.xhrFactory = xhrFactory;
|
|
1579
|
-
}
|
|
1580
|
-
/**
|
|
1581
|
-
* Processes a request and returns a stream of response events.
|
|
1582
|
-
* @param req The request object.
|
|
1583
|
-
* @returns An observable of the response events.
|
|
1584
|
-
*/
|
|
1585
|
-
handle(req) {
|
|
1586
|
-
if (req.method === "JSONP") {
|
|
1587
|
-
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.`);
|
|
1588
|
-
}
|
|
1589
|
-
const xhrFactory = this.xhrFactory;
|
|
1590
|
-
const source = xhrFactory.ɵloadImpl ? from(xhrFactory.ɵloadImpl()) : of(null);
|
|
1591
|
-
return source.pipe(switchMap(() => {
|
|
1592
|
-
return new Observable((observer) => {
|
|
1593
|
-
const xhr = xhrFactory.build();
|
|
1594
|
-
xhr.open(req.method, req.urlWithParams);
|
|
1595
|
-
if (req.withCredentials) {
|
|
1596
|
-
xhr.withCredentials = true;
|
|
1597
|
-
}
|
|
1598
|
-
req.headers.forEach((name, values) => xhr.setRequestHeader(name, values.join(",")));
|
|
1599
|
-
if (!req.headers.has("Accept")) {
|
|
1600
|
-
xhr.setRequestHeader("Accept", "application/json, text/plain, */*");
|
|
1601
|
-
}
|
|
1602
|
-
if (!req.headers.has("Content-Type")) {
|
|
1603
|
-
const detectedType = req.detectContentTypeHeader();
|
|
1604
|
-
if (detectedType !== null) {
|
|
1605
|
-
xhr.setRequestHeader("Content-Type", detectedType);
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
if (req.responseType) {
|
|
1609
|
-
const responseType = req.responseType.toLowerCase();
|
|
1610
|
-
xhr.responseType = responseType !== "json" ? responseType : "text";
|
|
1611
|
-
}
|
|
1612
|
-
const reqBody = req.serializeBody();
|
|
1613
|
-
let headerResponse = null;
|
|
1614
|
-
const partialFromXhr = () => {
|
|
1615
|
-
if (headerResponse !== null) {
|
|
1616
|
-
return headerResponse;
|
|
1617
|
-
}
|
|
1618
|
-
const statusText = xhr.statusText || "OK";
|
|
1619
|
-
const headers = new HttpHeaders(xhr.getAllResponseHeaders());
|
|
1620
|
-
const url = getResponseUrl(xhr) || req.url;
|
|
1621
|
-
headerResponse = new HttpHeaderResponse({
|
|
1622
|
-
headers,
|
|
1623
|
-
status: xhr.status,
|
|
1624
|
-
statusText,
|
|
1625
|
-
url
|
|
1626
|
-
});
|
|
1627
|
-
return headerResponse;
|
|
1628
|
-
};
|
|
1629
|
-
const onLoad = () => {
|
|
1630
|
-
let {
|
|
1631
|
-
headers,
|
|
1632
|
-
status,
|
|
1633
|
-
statusText,
|
|
1634
|
-
url
|
|
1635
|
-
} = partialFromXhr();
|
|
1636
|
-
let body = null;
|
|
1637
|
-
if (status !== HTTP_STATUS_CODE_NO_CONTENT) {
|
|
1638
|
-
body = typeof xhr.response === "undefined" ? xhr.responseText : xhr.response;
|
|
1639
|
-
}
|
|
1640
|
-
if (status === 0) {
|
|
1641
|
-
status = !!body ? HTTP_STATUS_CODE_OK : 0;
|
|
1642
|
-
}
|
|
1643
|
-
let ok = status >= 200 && status < 300;
|
|
1644
|
-
if (req.responseType === "json" && typeof body === "string") {
|
|
1645
|
-
const originalBody = body;
|
|
1646
|
-
body = body.replace(XSSI_PREFIX, "");
|
|
1647
|
-
try {
|
|
1648
|
-
body = body !== "" ? JSON.parse(body) : null;
|
|
1649
|
-
} catch (error) {
|
|
1650
|
-
body = originalBody;
|
|
1651
|
-
if (ok) {
|
|
1652
|
-
ok = false;
|
|
1653
|
-
body = {
|
|
1654
|
-
error,
|
|
1655
|
-
text: body
|
|
1656
|
-
};
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
if (ok) {
|
|
1661
|
-
observer.next(new HttpResponse({
|
|
1662
|
-
body,
|
|
1663
|
-
headers,
|
|
1664
|
-
status,
|
|
1665
|
-
statusText,
|
|
1666
|
-
url: url || void 0
|
|
1667
|
-
}));
|
|
1668
|
-
observer.complete();
|
|
1669
|
-
} else {
|
|
1670
|
-
observer.error(new HttpErrorResponse({
|
|
1671
|
-
// The error in this case is the response body (error from the server).
|
|
1672
|
-
error: body,
|
|
1673
|
-
headers,
|
|
1674
|
-
status,
|
|
1675
|
-
statusText,
|
|
1676
|
-
url: url || void 0
|
|
1677
|
-
}));
|
|
1678
|
-
}
|
|
1679
|
-
};
|
|
1680
|
-
const onError = (error) => {
|
|
1681
|
-
const {
|
|
1682
|
-
url
|
|
1683
|
-
} = partialFromXhr();
|
|
1684
|
-
const res = new HttpErrorResponse({
|
|
1685
|
-
error,
|
|
1686
|
-
status: xhr.status || 0,
|
|
1687
|
-
statusText: xhr.statusText || "Unknown Error",
|
|
1688
|
-
url: url || void 0
|
|
1689
|
-
});
|
|
1690
|
-
observer.error(res);
|
|
1691
|
-
};
|
|
1692
|
-
let sentHeaders = false;
|
|
1693
|
-
const onDownProgress = (event) => {
|
|
1694
|
-
if (!sentHeaders) {
|
|
1695
|
-
observer.next(partialFromXhr());
|
|
1696
|
-
sentHeaders = true;
|
|
1697
|
-
}
|
|
1698
|
-
let progressEvent = {
|
|
1699
|
-
type: HttpEventType.DownloadProgress,
|
|
1700
|
-
loaded: event.loaded
|
|
1701
|
-
};
|
|
1702
|
-
if (event.lengthComputable) {
|
|
1703
|
-
progressEvent.total = event.total;
|
|
1704
|
-
}
|
|
1705
|
-
if (req.responseType === "text" && !!xhr.responseText) {
|
|
1706
|
-
progressEvent.partialText = xhr.responseText;
|
|
1707
|
-
}
|
|
1708
|
-
observer.next(progressEvent);
|
|
1709
|
-
};
|
|
1710
|
-
const onUpProgress = (event) => {
|
|
1711
|
-
let progress = {
|
|
1712
|
-
type: HttpEventType.UploadProgress,
|
|
1713
|
-
loaded: event.loaded
|
|
1714
|
-
};
|
|
1715
|
-
if (event.lengthComputable) {
|
|
1716
|
-
progress.total = event.total;
|
|
1717
|
-
}
|
|
1718
|
-
observer.next(progress);
|
|
1719
|
-
};
|
|
1720
|
-
xhr.addEventListener("load", onLoad);
|
|
1721
|
-
xhr.addEventListener("error", onError);
|
|
1722
|
-
xhr.addEventListener("timeout", onError);
|
|
1723
|
-
xhr.addEventListener("abort", onError);
|
|
1724
|
-
if (req.reportProgress) {
|
|
1725
|
-
xhr.addEventListener("progress", onDownProgress);
|
|
1726
|
-
if (reqBody !== null && xhr.upload) {
|
|
1727
|
-
xhr.upload.addEventListener("progress", onUpProgress);
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
xhr.send(reqBody);
|
|
1731
|
-
observer.next({
|
|
1732
|
-
type: HttpEventType.Sent
|
|
1733
|
-
});
|
|
1734
|
-
return () => {
|
|
1735
|
-
xhr.removeEventListener("error", onError);
|
|
1736
|
-
xhr.removeEventListener("abort", onError);
|
|
1737
|
-
xhr.removeEventListener("load", onLoad);
|
|
1738
|
-
xhr.removeEventListener("timeout", onError);
|
|
1739
|
-
if (req.reportProgress) {
|
|
1740
|
-
xhr.removeEventListener("progress", onDownProgress);
|
|
1741
|
-
if (reqBody !== null && xhr.upload) {
|
|
1742
|
-
xhr.upload.removeEventListener("progress", onUpProgress);
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
if (xhr.readyState !== xhr.DONE) {
|
|
1746
|
-
xhr.abort();
|
|
1747
|
-
}
|
|
1748
|
-
};
|
|
1749
|
-
});
|
|
1750
|
-
}));
|
|
1751
|
-
}
|
|
1752
|
-
static {
|
|
1753
|
-
this.ɵfac = function HttpXhrBackend_Factory(__ngFactoryType__) {
|
|
1754
|
-
return new (__ngFactoryType__ || _HttpXhrBackend)(ɵɵinject(XhrFactory));
|
|
1755
|
-
};
|
|
1756
|
-
}
|
|
1757
|
-
static {
|
|
1758
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1759
|
-
token: _HttpXhrBackend,
|
|
1760
|
-
factory: _HttpXhrBackend.ɵfac
|
|
1761
|
-
});
|
|
1762
|
-
}
|
|
1763
|
-
};
|
|
1764
|
-
(() => {
|
|
1765
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXhrBackend, [{
|
|
1766
|
-
type: Injectable
|
|
1767
|
-
}], () => [{
|
|
1768
|
-
type: XhrFactory
|
|
1769
|
-
}], null);
|
|
1770
|
-
})();
|
|
1771
|
-
var XSRF_ENABLED = new InjectionToken(ngDevMode ? "XSRF_ENABLED" : "");
|
|
1772
|
-
var XSRF_DEFAULT_COOKIE_NAME = "XSRF-TOKEN";
|
|
1773
|
-
var XSRF_COOKIE_NAME = new InjectionToken(ngDevMode ? "XSRF_COOKIE_NAME" : "", {
|
|
1774
|
-
providedIn: "root",
|
|
1775
|
-
factory: () => XSRF_DEFAULT_COOKIE_NAME
|
|
1776
|
-
});
|
|
1777
|
-
var XSRF_DEFAULT_HEADER_NAME = "X-XSRF-TOKEN";
|
|
1778
|
-
var XSRF_HEADER_NAME = new InjectionToken(ngDevMode ? "XSRF_HEADER_NAME" : "", {
|
|
1779
|
-
providedIn: "root",
|
|
1780
|
-
factory: () => XSRF_DEFAULT_HEADER_NAME
|
|
1781
|
-
});
|
|
1782
|
-
var HttpXsrfTokenExtractor = class {
|
|
1783
|
-
};
|
|
1784
|
-
var HttpXsrfCookieExtractor = class _HttpXsrfCookieExtractor {
|
|
1785
|
-
constructor(doc, platform, cookieName) {
|
|
1786
|
-
this.doc = doc;
|
|
1787
|
-
this.platform = platform;
|
|
1788
|
-
this.cookieName = cookieName;
|
|
1789
|
-
this.lastCookieString = "";
|
|
1790
|
-
this.lastToken = null;
|
|
1791
|
-
this.parseCount = 0;
|
|
1792
|
-
}
|
|
1793
|
-
getToken() {
|
|
1794
|
-
if (this.platform === "server") {
|
|
1795
|
-
return null;
|
|
1796
|
-
}
|
|
1797
|
-
const cookieString = this.doc.cookie || "";
|
|
1798
|
-
if (cookieString !== this.lastCookieString) {
|
|
1799
|
-
this.parseCount++;
|
|
1800
|
-
this.lastToken = parseCookieValue(cookieString, this.cookieName);
|
|
1801
|
-
this.lastCookieString = cookieString;
|
|
1802
|
-
}
|
|
1803
|
-
return this.lastToken;
|
|
1804
|
-
}
|
|
1805
|
-
static {
|
|
1806
|
-
this.ɵfac = function HttpXsrfCookieExtractor_Factory(__ngFactoryType__) {
|
|
1807
|
-
return new (__ngFactoryType__ || _HttpXsrfCookieExtractor)(ɵɵinject(DOCUMENT), ɵɵinject(PLATFORM_ID), ɵɵinject(XSRF_COOKIE_NAME));
|
|
1808
|
-
};
|
|
1809
|
-
}
|
|
1810
|
-
static {
|
|
1811
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1812
|
-
token: _HttpXsrfCookieExtractor,
|
|
1813
|
-
factory: _HttpXsrfCookieExtractor.ɵfac
|
|
1814
|
-
});
|
|
1815
|
-
}
|
|
1816
|
-
};
|
|
1817
|
-
(() => {
|
|
1818
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfCookieExtractor, [{
|
|
1819
|
-
type: Injectable
|
|
1820
|
-
}], () => [{
|
|
1821
|
-
type: void 0,
|
|
1822
|
-
decorators: [{
|
|
1823
|
-
type: Inject,
|
|
1824
|
-
args: [DOCUMENT]
|
|
1825
|
-
}]
|
|
1826
|
-
}, {
|
|
1827
|
-
type: void 0,
|
|
1828
|
-
decorators: [{
|
|
1829
|
-
type: Inject,
|
|
1830
|
-
args: [PLATFORM_ID]
|
|
1831
|
-
}]
|
|
1832
|
-
}, {
|
|
1833
|
-
type: void 0,
|
|
1834
|
-
decorators: [{
|
|
1835
|
-
type: Inject,
|
|
1836
|
-
args: [XSRF_COOKIE_NAME]
|
|
1837
|
-
}]
|
|
1838
|
-
}], null);
|
|
1839
|
-
})();
|
|
1840
|
-
function xsrfInterceptorFn(req, next) {
|
|
1841
|
-
const lcUrl = req.url.toLowerCase();
|
|
1842
|
-
if (!inject(XSRF_ENABLED) || req.method === "GET" || req.method === "HEAD" || lcUrl.startsWith("http://") || lcUrl.startsWith("https://")) {
|
|
1843
|
-
return next(req);
|
|
1844
|
-
}
|
|
1845
|
-
const token = inject(HttpXsrfTokenExtractor).getToken();
|
|
1846
|
-
const headerName = inject(XSRF_HEADER_NAME);
|
|
1847
|
-
if (token != null && !req.headers.has(headerName)) {
|
|
1848
|
-
req = req.clone({
|
|
1849
|
-
headers: req.headers.set(headerName, token)
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
|
-
return next(req);
|
|
1853
|
-
}
|
|
1854
|
-
var HttpXsrfInterceptor = class _HttpXsrfInterceptor {
|
|
1855
|
-
constructor(injector) {
|
|
1856
|
-
this.injector = injector;
|
|
1857
|
-
}
|
|
1858
|
-
intercept(initialRequest, next) {
|
|
1859
|
-
return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
1860
|
-
}
|
|
1861
|
-
static {
|
|
1862
|
-
this.ɵfac = function HttpXsrfInterceptor_Factory(__ngFactoryType__) {
|
|
1863
|
-
return new (__ngFactoryType__ || _HttpXsrfInterceptor)(ɵɵinject(EnvironmentInjector));
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
|
-
static {
|
|
1867
|
-
this.ɵprov = ɵɵdefineInjectable({
|
|
1868
|
-
token: _HttpXsrfInterceptor,
|
|
1869
|
-
factory: _HttpXsrfInterceptor.ɵfac
|
|
1870
|
-
});
|
|
1871
|
-
}
|
|
1872
|
-
};
|
|
1873
|
-
(() => {
|
|
1874
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfInterceptor, [{
|
|
1875
|
-
type: Injectable
|
|
1876
|
-
}], () => [{
|
|
1877
|
-
type: EnvironmentInjector
|
|
1878
|
-
}], null);
|
|
1879
|
-
})();
|
|
1880
|
-
var HttpFeatureKind;
|
|
1881
|
-
(function(HttpFeatureKind2) {
|
|
1882
|
-
HttpFeatureKind2[HttpFeatureKind2["Interceptors"] = 0] = "Interceptors";
|
|
1883
|
-
HttpFeatureKind2[HttpFeatureKind2["LegacyInterceptors"] = 1] = "LegacyInterceptors";
|
|
1884
|
-
HttpFeatureKind2[HttpFeatureKind2["CustomXsrfConfiguration"] = 2] = "CustomXsrfConfiguration";
|
|
1885
|
-
HttpFeatureKind2[HttpFeatureKind2["NoXsrfProtection"] = 3] = "NoXsrfProtection";
|
|
1886
|
-
HttpFeatureKind2[HttpFeatureKind2["JsonpSupport"] = 4] = "JsonpSupport";
|
|
1887
|
-
HttpFeatureKind2[HttpFeatureKind2["RequestsMadeViaParent"] = 5] = "RequestsMadeViaParent";
|
|
1888
|
-
HttpFeatureKind2[HttpFeatureKind2["Fetch"] = 6] = "Fetch";
|
|
1889
|
-
})(HttpFeatureKind || (HttpFeatureKind = {}));
|
|
1890
|
-
function makeHttpFeature(kind, providers) {
|
|
1891
|
-
return {
|
|
1892
|
-
ɵkind: kind,
|
|
1893
|
-
ɵproviders: providers
|
|
1894
|
-
};
|
|
1895
|
-
}
|
|
1896
|
-
function provideHttpClient(...features) {
|
|
1897
|
-
if (ngDevMode) {
|
|
1898
|
-
const featureKinds = new Set(features.map((f) => f.ɵkind));
|
|
1899
|
-
if (featureKinds.has(HttpFeatureKind.NoXsrfProtection) && featureKinds.has(HttpFeatureKind.CustomXsrfConfiguration)) {
|
|
1900
|
-
throw new Error(ngDevMode ? `Configuration error: found both withXsrfConfiguration() and withNoXsrfProtection() in the same call to provideHttpClient(), which is a contradiction.` : "");
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
const providers = [HttpClient, HttpXhrBackend, HttpInterceptorHandler, {
|
|
1904
|
-
provide: HttpHandler,
|
|
1905
|
-
useExisting: HttpInterceptorHandler
|
|
1906
|
-
}, {
|
|
1907
|
-
provide: HttpBackend,
|
|
1908
|
-
useFactory: () => {
|
|
1909
|
-
return inject(FetchBackend, {
|
|
1910
|
-
optional: true
|
|
1911
|
-
}) ?? inject(HttpXhrBackend);
|
|
1912
|
-
}
|
|
1913
|
-
}, {
|
|
1914
|
-
provide: HTTP_INTERCEPTOR_FNS,
|
|
1915
|
-
useValue: xsrfInterceptorFn,
|
|
1916
|
-
multi: true
|
|
1917
|
-
}, {
|
|
1918
|
-
provide: XSRF_ENABLED,
|
|
1919
|
-
useValue: true
|
|
1920
|
-
}, {
|
|
1921
|
-
provide: HttpXsrfTokenExtractor,
|
|
1922
|
-
useClass: HttpXsrfCookieExtractor
|
|
1923
|
-
}];
|
|
1924
|
-
for (const feature of features) {
|
|
1925
|
-
providers.push(...feature.ɵproviders);
|
|
1926
|
-
}
|
|
1927
|
-
return makeEnvironmentProviders(providers);
|
|
1928
|
-
}
|
|
1929
|
-
function withInterceptors(interceptorFns) {
|
|
1930
|
-
return makeHttpFeature(HttpFeatureKind.Interceptors, interceptorFns.map((interceptorFn) => {
|
|
1931
|
-
return {
|
|
1932
|
-
provide: HTTP_INTERCEPTOR_FNS,
|
|
1933
|
-
useValue: interceptorFn,
|
|
1934
|
-
multi: true
|
|
1935
|
-
};
|
|
1936
|
-
}));
|
|
1937
|
-
}
|
|
1938
|
-
var LEGACY_INTERCEPTOR_FN = new InjectionToken(ngDevMode ? "LEGACY_INTERCEPTOR_FN" : "");
|
|
1939
|
-
function withInterceptorsFromDi() {
|
|
1940
|
-
return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [{
|
|
1941
|
-
provide: LEGACY_INTERCEPTOR_FN,
|
|
1942
|
-
useFactory: legacyInterceptorFnFactory
|
|
1943
|
-
}, {
|
|
1944
|
-
provide: HTTP_INTERCEPTOR_FNS,
|
|
1945
|
-
useExisting: LEGACY_INTERCEPTOR_FN,
|
|
1946
|
-
multi: true
|
|
1947
|
-
}]);
|
|
1948
|
-
}
|
|
1949
|
-
function withXsrfConfiguration({
|
|
1950
|
-
cookieName,
|
|
1951
|
-
headerName
|
|
1952
|
-
}) {
|
|
1953
|
-
const providers = [];
|
|
1954
|
-
if (cookieName !== void 0) {
|
|
1955
|
-
providers.push({
|
|
1956
|
-
provide: XSRF_COOKIE_NAME,
|
|
1957
|
-
useValue: cookieName
|
|
1958
|
-
});
|
|
1959
|
-
}
|
|
1960
|
-
if (headerName !== void 0) {
|
|
1961
|
-
providers.push({
|
|
1962
|
-
provide: XSRF_HEADER_NAME,
|
|
1963
|
-
useValue: headerName
|
|
1964
|
-
});
|
|
1965
|
-
}
|
|
1966
|
-
return makeHttpFeature(HttpFeatureKind.CustomXsrfConfiguration, providers);
|
|
1967
|
-
}
|
|
1968
|
-
function withNoXsrfProtection() {
|
|
1969
|
-
return makeHttpFeature(HttpFeatureKind.NoXsrfProtection, [{
|
|
1970
|
-
provide: XSRF_ENABLED,
|
|
1971
|
-
useValue: false
|
|
1972
|
-
}]);
|
|
1973
|
-
}
|
|
1974
|
-
function withJsonpSupport() {
|
|
1975
|
-
return makeHttpFeature(HttpFeatureKind.JsonpSupport, [JsonpClientBackend, {
|
|
1976
|
-
provide: JsonpCallbackContext,
|
|
1977
|
-
useFactory: jsonpCallbackContext
|
|
1978
|
-
}, {
|
|
1979
|
-
provide: HTTP_INTERCEPTOR_FNS,
|
|
1980
|
-
useValue: jsonpInterceptorFn,
|
|
1981
|
-
multi: true
|
|
1982
|
-
}]);
|
|
1983
|
-
}
|
|
1984
|
-
function withRequestsMadeViaParent() {
|
|
1985
|
-
return makeHttpFeature(HttpFeatureKind.RequestsMadeViaParent, [{
|
|
1986
|
-
provide: HttpBackend,
|
|
1987
|
-
useFactory: () => {
|
|
1988
|
-
const handlerFromParent = inject(HttpHandler, {
|
|
1989
|
-
skipSelf: true,
|
|
1990
|
-
optional: true
|
|
1991
|
-
});
|
|
1992
|
-
if (ngDevMode && handlerFromParent === null) {
|
|
1993
|
-
throw new Error("withRequestsMadeViaParent() can only be used when the parent injector also configures HttpClient");
|
|
1994
|
-
}
|
|
1995
|
-
return handlerFromParent;
|
|
1996
|
-
}
|
|
1997
|
-
}]);
|
|
1998
|
-
}
|
|
1999
|
-
function withFetch() {
|
|
2000
|
-
return makeHttpFeature(HttpFeatureKind.Fetch, [FetchBackend, {
|
|
2001
|
-
provide: HttpBackend,
|
|
2002
|
-
useExisting: FetchBackend
|
|
2003
|
-
}]);
|
|
2004
|
-
}
|
|
2005
|
-
var HttpClientXsrfModule = class _HttpClientXsrfModule {
|
|
2006
|
-
/**
|
|
2007
|
-
* Disable the default XSRF protection.
|
|
2008
|
-
*/
|
|
2009
|
-
static disable() {
|
|
2010
|
-
return {
|
|
2011
|
-
ngModule: _HttpClientXsrfModule,
|
|
2012
|
-
providers: [withNoXsrfProtection().ɵproviders]
|
|
2013
|
-
};
|
|
2014
|
-
}
|
|
2015
|
-
/**
|
|
2016
|
-
* Configure XSRF protection.
|
|
2017
|
-
* @param options An object that can specify either or both
|
|
2018
|
-
* cookie name or header name.
|
|
2019
|
-
* - Cookie name default is `XSRF-TOKEN`.
|
|
2020
|
-
* - Header name default is `X-XSRF-TOKEN`.
|
|
2021
|
-
*
|
|
2022
|
-
*/
|
|
2023
|
-
static withOptions(options = {}) {
|
|
2024
|
-
return {
|
|
2025
|
-
ngModule: _HttpClientXsrfModule,
|
|
2026
|
-
providers: withXsrfConfiguration(options).ɵproviders
|
|
2027
|
-
};
|
|
2028
|
-
}
|
|
2029
|
-
static {
|
|
2030
|
-
this.ɵfac = function HttpClientXsrfModule_Factory(__ngFactoryType__) {
|
|
2031
|
-
return new (__ngFactoryType__ || _HttpClientXsrfModule)();
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
static {
|
|
2035
|
-
this.ɵmod = ɵɵdefineNgModule({
|
|
2036
|
-
type: _HttpClientXsrfModule
|
|
2037
|
-
});
|
|
2038
|
-
}
|
|
2039
|
-
static {
|
|
2040
|
-
this.ɵinj = ɵɵdefineInjector({
|
|
2041
|
-
providers: [HttpXsrfInterceptor, {
|
|
2042
|
-
provide: HTTP_INTERCEPTORS,
|
|
2043
|
-
useExisting: HttpXsrfInterceptor,
|
|
2044
|
-
multi: true
|
|
2045
|
-
}, {
|
|
2046
|
-
provide: HttpXsrfTokenExtractor,
|
|
2047
|
-
useClass: HttpXsrfCookieExtractor
|
|
2048
|
-
}, withXsrfConfiguration({
|
|
2049
|
-
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
2050
|
-
headerName: XSRF_DEFAULT_HEADER_NAME
|
|
2051
|
-
}).ɵproviders, {
|
|
2052
|
-
provide: XSRF_ENABLED,
|
|
2053
|
-
useValue: true
|
|
2054
|
-
}]
|
|
2055
|
-
});
|
|
2056
|
-
}
|
|
2057
|
-
};
|
|
2058
|
-
(() => {
|
|
2059
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientXsrfModule, [{
|
|
2060
|
-
type: NgModule,
|
|
2061
|
-
args: [{
|
|
2062
|
-
providers: [HttpXsrfInterceptor, {
|
|
2063
|
-
provide: HTTP_INTERCEPTORS,
|
|
2064
|
-
useExisting: HttpXsrfInterceptor,
|
|
2065
|
-
multi: true
|
|
2066
|
-
}, {
|
|
2067
|
-
provide: HttpXsrfTokenExtractor,
|
|
2068
|
-
useClass: HttpXsrfCookieExtractor
|
|
2069
|
-
}, withXsrfConfiguration({
|
|
2070
|
-
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
2071
|
-
headerName: XSRF_DEFAULT_HEADER_NAME
|
|
2072
|
-
}).ɵproviders, {
|
|
2073
|
-
provide: XSRF_ENABLED,
|
|
2074
|
-
useValue: true
|
|
2075
|
-
}]
|
|
2076
|
-
}]
|
|
2077
|
-
}], null, null);
|
|
2078
|
-
})();
|
|
2079
|
-
var HttpClientModule = class _HttpClientModule {
|
|
2080
|
-
static {
|
|
2081
|
-
this.ɵfac = function HttpClientModule_Factory(__ngFactoryType__) {
|
|
2082
|
-
return new (__ngFactoryType__ || _HttpClientModule)();
|
|
2083
|
-
};
|
|
2084
|
-
}
|
|
2085
|
-
static {
|
|
2086
|
-
this.ɵmod = ɵɵdefineNgModule({
|
|
2087
|
-
type: _HttpClientModule
|
|
2088
|
-
});
|
|
2089
|
-
}
|
|
2090
|
-
static {
|
|
2091
|
-
this.ɵinj = ɵɵdefineInjector({
|
|
2092
|
-
providers: [provideHttpClient(withInterceptorsFromDi())]
|
|
2093
|
-
});
|
|
2094
|
-
}
|
|
2095
|
-
};
|
|
2096
|
-
(() => {
|
|
2097
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientModule, [{
|
|
2098
|
-
type: NgModule,
|
|
2099
|
-
args: [{
|
|
2100
|
-
/**
|
|
2101
|
-
* Configures the dependency injector where it is imported
|
|
2102
|
-
* with supporting services for HTTP communications.
|
|
2103
|
-
*/
|
|
2104
|
-
providers: [provideHttpClient(withInterceptorsFromDi())]
|
|
2105
|
-
}]
|
|
2106
|
-
}], null, null);
|
|
2107
|
-
})();
|
|
2108
|
-
var HttpClientJsonpModule = class _HttpClientJsonpModule {
|
|
2109
|
-
static {
|
|
2110
|
-
this.ɵfac = function HttpClientJsonpModule_Factory(__ngFactoryType__) {
|
|
2111
|
-
return new (__ngFactoryType__ || _HttpClientJsonpModule)();
|
|
2112
|
-
};
|
|
2113
|
-
}
|
|
2114
|
-
static {
|
|
2115
|
-
this.ɵmod = ɵɵdefineNgModule({
|
|
2116
|
-
type: _HttpClientJsonpModule
|
|
2117
|
-
});
|
|
2118
|
-
}
|
|
2119
|
-
static {
|
|
2120
|
-
this.ɵinj = ɵɵdefineInjector({
|
|
2121
|
-
providers: [withJsonpSupport().ɵproviders]
|
|
2122
|
-
});
|
|
2123
|
-
}
|
|
2124
|
-
};
|
|
2125
|
-
(() => {
|
|
2126
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientJsonpModule, [{
|
|
2127
|
-
type: NgModule,
|
|
2128
|
-
args: [{
|
|
2129
|
-
providers: [withJsonpSupport().ɵproviders]
|
|
2130
|
-
}]
|
|
2131
|
-
}], null, null);
|
|
2132
|
-
})();
|
|
2133
|
-
var HTTP_TRANSFER_CACHE_ORIGIN_MAP = new InjectionToken(ngDevMode ? "HTTP_TRANSFER_CACHE_ORIGIN_MAP" : "");
|
|
2134
|
-
var BODY = "b";
|
|
2135
|
-
var HEADERS = "h";
|
|
2136
|
-
var STATUS = "s";
|
|
2137
|
-
var STATUS_TEXT = "st";
|
|
2138
|
-
var REQ_URL = "u";
|
|
2139
|
-
var RESPONSE_TYPE = "rt";
|
|
2140
|
-
var CACHE_OPTIONS = new InjectionToken(ngDevMode ? "HTTP_TRANSFER_STATE_CACHE_OPTIONS" : "");
|
|
2141
|
-
var ALLOWED_METHODS = ["GET", "HEAD"];
|
|
2142
|
-
function transferCacheInterceptorFn(req, next) {
|
|
2143
|
-
const _a = inject(CACHE_OPTIONS), {
|
|
2144
|
-
isCacheActive
|
|
2145
|
-
} = _a, globalOptions = __objRest(_a, [
|
|
2146
|
-
"isCacheActive"
|
|
2147
|
-
]);
|
|
2148
|
-
const {
|
|
2149
|
-
transferCache: requestOptions,
|
|
2150
|
-
method: requestMethod
|
|
2151
|
-
} = req;
|
|
2152
|
-
if (!isCacheActive || requestOptions === false || // POST requests are allowed either globally or at request level
|
|
2153
|
-
requestMethod === "POST" && !globalOptions.includePostRequests && !requestOptions || requestMethod !== "POST" && !ALLOWED_METHODS.includes(requestMethod) || // Do not cache request that require authorization when includeRequestsWithAuthHeaders is falsey
|
|
2154
|
-
!globalOptions.includeRequestsWithAuthHeaders && hasAuthHeaders(req) || globalOptions.filter?.(req) === false) {
|
|
2155
|
-
return next(req);
|
|
2156
|
-
}
|
|
2157
|
-
const transferState = inject(TransferState);
|
|
2158
|
-
const originMap = inject(HTTP_TRANSFER_CACHE_ORIGIN_MAP, {
|
|
2159
|
-
optional: true
|
|
2160
|
-
});
|
|
2161
|
-
const isServer = isPlatformServer(inject(PLATFORM_ID));
|
|
2162
|
-
if (originMap && !isServer) {
|
|
2163
|
-
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.");
|
|
2164
|
-
}
|
|
2165
|
-
const requestUrl = isServer && originMap ? mapRequestOriginUrl(req.url, originMap) : req.url;
|
|
2166
|
-
const storeKey = makeCacheKey(req, requestUrl);
|
|
2167
|
-
const response = transferState.get(storeKey, null);
|
|
2168
|
-
let headersToInclude = globalOptions.includeHeaders;
|
|
2169
|
-
if (typeof requestOptions === "object" && requestOptions.includeHeaders) {
|
|
2170
|
-
headersToInclude = requestOptions.includeHeaders;
|
|
2171
|
-
}
|
|
2172
|
-
if (response) {
|
|
2173
|
-
const {
|
|
2174
|
-
[BODY]: undecodedBody,
|
|
2175
|
-
[RESPONSE_TYPE]: responseType,
|
|
2176
|
-
[HEADERS]: httpHeaders,
|
|
2177
|
-
[STATUS]: status,
|
|
2178
|
-
[STATUS_TEXT]: statusText,
|
|
2179
|
-
[REQ_URL]: url
|
|
2180
|
-
} = response;
|
|
2181
|
-
let body = undecodedBody;
|
|
2182
|
-
switch (responseType) {
|
|
2183
|
-
case "arraybuffer":
|
|
2184
|
-
body = new TextEncoder().encode(undecodedBody).buffer;
|
|
2185
|
-
break;
|
|
2186
|
-
case "blob":
|
|
2187
|
-
body = new Blob([undecodedBody]);
|
|
2188
|
-
break;
|
|
2189
|
-
}
|
|
2190
|
-
let headers = new HttpHeaders(httpHeaders);
|
|
2191
|
-
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
2192
|
-
headers = appendMissingHeadersDetection(req.url, headers, headersToInclude ?? []);
|
|
2193
|
-
}
|
|
2194
|
-
return of(new HttpResponse({
|
|
2195
|
-
body,
|
|
2196
|
-
headers,
|
|
2197
|
-
status,
|
|
2198
|
-
statusText,
|
|
2199
|
-
url
|
|
2200
|
-
}));
|
|
2201
|
-
}
|
|
2202
|
-
return next(req).pipe(tap((event) => {
|
|
2203
|
-
if (event instanceof HttpResponse && isServer) {
|
|
2204
|
-
transferState.set(storeKey, {
|
|
2205
|
-
[BODY]: event.body,
|
|
2206
|
-
[HEADERS]: getFilteredHeaders(event.headers, headersToInclude),
|
|
2207
|
-
[STATUS]: event.status,
|
|
2208
|
-
[STATUS_TEXT]: event.statusText,
|
|
2209
|
-
[REQ_URL]: requestUrl,
|
|
2210
|
-
[RESPONSE_TYPE]: req.responseType
|
|
2211
|
-
});
|
|
2212
|
-
}
|
|
2213
|
-
}));
|
|
2214
|
-
}
|
|
2215
|
-
function hasAuthHeaders(req) {
|
|
2216
|
-
return req.headers.has("authorization") || req.headers.has("proxy-authorization");
|
|
2217
|
-
}
|
|
2218
|
-
function getFilteredHeaders(headers, includeHeaders) {
|
|
2219
|
-
if (!includeHeaders) {
|
|
2220
|
-
return {};
|
|
2221
|
-
}
|
|
2222
|
-
const headersMap = {};
|
|
2223
|
-
for (const key of includeHeaders) {
|
|
2224
|
-
const values = headers.getAll(key);
|
|
2225
|
-
if (values !== null) {
|
|
2226
|
-
headersMap[key] = values;
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
return headersMap;
|
|
2230
|
-
}
|
|
2231
|
-
function sortAndConcatParams(params) {
|
|
2232
|
-
return [...params.keys()].sort().map((k) => `${k}=${params.getAll(k)}`).join("&");
|
|
2233
|
-
}
|
|
2234
|
-
function makeCacheKey(request, mappedRequestUrl) {
|
|
2235
|
-
const {
|
|
2236
|
-
params,
|
|
2237
|
-
method,
|
|
2238
|
-
responseType
|
|
2239
|
-
} = request;
|
|
2240
|
-
const encodedParams = sortAndConcatParams(params);
|
|
2241
|
-
let serializedBody = request.serializeBody();
|
|
2242
|
-
if (serializedBody instanceof URLSearchParams) {
|
|
2243
|
-
serializedBody = sortAndConcatParams(serializedBody);
|
|
2244
|
-
} else if (typeof serializedBody !== "string") {
|
|
2245
|
-
serializedBody = "";
|
|
2246
|
-
}
|
|
2247
|
-
const key = [method, responseType, mappedRequestUrl, serializedBody, encodedParams].join("|");
|
|
2248
|
-
const hash = generateHash(key);
|
|
2249
|
-
return makeStateKey(hash);
|
|
2250
|
-
}
|
|
2251
|
-
function generateHash(value) {
|
|
2252
|
-
let hash = 0;
|
|
2253
|
-
for (const char of value) {
|
|
2254
|
-
hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;
|
|
2255
|
-
}
|
|
2256
|
-
hash += 2147483647 + 1;
|
|
2257
|
-
return hash.toString();
|
|
2258
|
-
}
|
|
2259
|
-
function withHttpTransferCache(cacheOptions) {
|
|
2260
|
-
return [{
|
|
2261
|
-
provide: CACHE_OPTIONS,
|
|
2262
|
-
useFactory: () => {
|
|
2263
|
-
performanceMarkFeature("NgHttpTransferCache");
|
|
2264
|
-
return __spreadValues({
|
|
2265
|
-
isCacheActive: true
|
|
2266
|
-
}, cacheOptions);
|
|
2267
|
-
}
|
|
2268
|
-
}, {
|
|
2269
|
-
provide: HTTP_ROOT_INTERCEPTOR_FNS,
|
|
2270
|
-
useValue: transferCacheInterceptorFn,
|
|
2271
|
-
multi: true,
|
|
2272
|
-
deps: [TransferState, CACHE_OPTIONS]
|
|
2273
|
-
}, {
|
|
2274
|
-
provide: APP_BOOTSTRAP_LISTENER,
|
|
2275
|
-
multi: true,
|
|
2276
|
-
useFactory: () => {
|
|
2277
|
-
const appRef = inject(ApplicationRef);
|
|
2278
|
-
const cacheState = inject(CACHE_OPTIONS);
|
|
2279
|
-
return () => {
|
|
2280
|
-
whenStable(appRef).then(() => {
|
|
2281
|
-
cacheState.isCacheActive = false;
|
|
2282
|
-
});
|
|
2283
|
-
};
|
|
2284
|
-
}
|
|
2285
|
-
}];
|
|
2286
|
-
}
|
|
2287
|
-
function appendMissingHeadersDetection(url, headers, headersToInclude) {
|
|
2288
|
-
const warningProduced = /* @__PURE__ */ new Set();
|
|
2289
|
-
return new Proxy(headers, {
|
|
2290
|
-
get(target, prop) {
|
|
2291
|
-
const value = Reflect.get(target, prop);
|
|
2292
|
-
const methods = /* @__PURE__ */ new Set(["get", "has", "getAll"]);
|
|
2293
|
-
if (typeof value !== "function" || !methods.has(prop)) {
|
|
2294
|
-
return value;
|
|
2295
|
-
}
|
|
2296
|
-
return (headerName) => {
|
|
2297
|
-
const key = (prop + ":" + headerName).toLowerCase();
|
|
2298
|
-
if (!headersToInclude.includes(headerName) && !warningProduced.has(key)) {
|
|
2299
|
-
warningProduced.add(key);
|
|
2300
|
-
const truncatedUrl = truncateMiddle(url);
|
|
2301
|
-
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. `));
|
|
2302
|
-
}
|
|
2303
|
-
return value.apply(target, [headerName]);
|
|
2304
|
-
};
|
|
2305
|
-
}
|
|
2306
|
-
});
|
|
2307
|
-
}
|
|
2308
|
-
function mapRequestOriginUrl(url, originMap) {
|
|
2309
|
-
const origin = new URL(url, "resolve://").origin;
|
|
2310
|
-
const mappedOrigin = originMap[origin];
|
|
2311
|
-
if (!mappedOrigin) {
|
|
2312
|
-
return url;
|
|
2313
|
-
}
|
|
2314
|
-
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
2315
|
-
verifyMappedOrigin(mappedOrigin);
|
|
2316
|
-
}
|
|
2317
|
-
return url.replace(origin, mappedOrigin);
|
|
2318
|
-
}
|
|
2319
|
-
function verifyMappedOrigin(url) {
|
|
2320
|
-
if (new URL(url, "resolve://").pathname !== "/") {
|
|
2321
|
-
throw new RuntimeError(2804, `Angular detected a URL with a path segment in the value provided for the \`HTTP_TRANSFER_CACHE_ORIGIN_MAP\` token: ${url}. The map should only contain origins without any other segments.`);
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
|
|
2325
|
-
export {
|
|
2326
|
-
HttpHandler,
|
|
2327
|
-
HttpBackend,
|
|
2328
|
-
HttpHeaders,
|
|
2329
|
-
HttpUrlEncodingCodec,
|
|
2330
|
-
HttpParams,
|
|
2331
|
-
HttpContextToken,
|
|
2332
|
-
HttpContext,
|
|
2333
|
-
HttpRequest,
|
|
2334
|
-
HttpEventType,
|
|
2335
|
-
HttpResponseBase,
|
|
2336
|
-
HttpHeaderResponse,
|
|
2337
|
-
HttpResponse,
|
|
2338
|
-
HttpErrorResponse,
|
|
2339
|
-
HttpStatusCode,
|
|
2340
|
-
HttpClient,
|
|
2341
|
-
FetchBackend,
|
|
2342
|
-
HTTP_INTERCEPTORS,
|
|
2343
|
-
HTTP_ROOT_INTERCEPTOR_FNS,
|
|
2344
|
-
REQUESTS_CONTRIBUTE_TO_STABILITY,
|
|
2345
|
-
HttpInterceptorHandler,
|
|
2346
|
-
JsonpClientBackend,
|
|
2347
|
-
JsonpInterceptor,
|
|
2348
|
-
HttpXhrBackend,
|
|
2349
|
-
HttpXsrfTokenExtractor,
|
|
2350
|
-
HttpFeatureKind,
|
|
2351
|
-
provideHttpClient,
|
|
2352
|
-
withInterceptors,
|
|
2353
|
-
withInterceptorsFromDi,
|
|
2354
|
-
withXsrfConfiguration,
|
|
2355
|
-
withNoXsrfProtection,
|
|
2356
|
-
withJsonpSupport,
|
|
2357
|
-
withRequestsMadeViaParent,
|
|
2358
|
-
withFetch,
|
|
2359
|
-
HttpClientXsrfModule,
|
|
2360
|
-
HttpClientModule,
|
|
2361
|
-
HttpClientJsonpModule,
|
|
2362
|
-
HTTP_TRANSFER_CACHE_ORIGIN_MAP,
|
|
2363
|
-
withHttpTransferCache
|
|
2364
|
-
};
|
|
2365
|
-
/*! Bundled license information:
|
|
2366
|
-
|
|
2367
|
-
@angular/common/fesm2022/http.mjs:
|
|
2368
|
-
(**
|
|
2369
|
-
* @license Angular v18.2.14
|
|
2370
|
-
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
2371
|
-
* License: MIT
|
|
2372
|
-
*)
|
|
2373
|
-
*/
|
|
2374
|
-
//# sourceMappingURL=chunk-A5IWFVHJ.js.map
|