@yelon/util 15.1.2 → 15.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +22 -22
- package/array/array-type.service.d.ts +68 -68
- package/array/array.service.d.ts +78 -78
- package/array/index.d.ts +2 -2
- package/browser/cookie.service.d.ts +67 -67
- package/browser/copy.d.ts +6 -6
- package/browser/index.d.ts +5 -5
- package/browser/is-empty.d.ts +6 -6
- package/browser/scroll.service.d.ts +37 -37
- package/browser/style.d.ts +21 -21
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/exception.type.d.ts +9 -9
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +17 -17
- package/config/abc/loading.type.d.ts +31 -31
- package/config/abc/lodop.type.d.ts +33 -33
- package/config/abc/media.type.d.ts +11 -11
- package/config/abc/onboarding.type.d.ts +4 -4
- package/config/abc/page-header.type.d.ts +39 -39
- package/config/abc/pdf.type.d.ts +35 -35
- package/config/abc/qr.type.d.ts +25 -25
- package/config/abc/se.type.d.ts +32 -32
- package/config/abc/sg.type.d.ts +10 -10
- package/config/abc/st.type.d.ts +465 -465
- package/config/abc/sv.type.d.ts +14 -14
- package/config/abc/xlsx.type.d.ts +12 -12
- package/config/abc/zip.type.d.ts +10 -10
- package/config/acl/acl.type.d.ts +32 -32
- package/config/auth/auth.type.d.ts +55 -55
- package/config/bis/bis.type.d.ts +7 -7
- package/config/cache/cache.type.d.ts +40 -40
- package/config/chart/chart.type.d.ts +33 -33
- package/config/config.service.d.ts +13 -13
- package/config/config.types.d.ts +48 -48
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/sf/sf.type.d.ts +133 -133
- package/config/socket/socket.type.d.ts +4 -4
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +14 -14
- package/config/theme/index.d.ts +3 -3
- package/config/theme/responsive.type.d.ts +12 -12
- package/config/util/array.type.d.ts +22 -22
- package/config/util/currency.type.d.ts +39 -39
- package/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +29 -29
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/zone-outside.d.ts +35 -35
- package/esm2020/array/array-type.service.mjs +1 -1
- package/esm2020/array/array.mjs +4 -4
- package/esm2020/array/array.service.mjs +276 -276
- package/esm2020/array/index.mjs +2 -2
- package/esm2020/browser/browser.mjs +4 -4
- package/esm2020/browser/cookie.service.mjs +102 -102
- package/esm2020/browser/copy.mjs +27 -27
- package/esm2020/browser/index.mjs +5 -5
- package/esm2020/browser/is-empty.mjs +18 -18
- package/esm2020/browser/scroll.service.mjs +87 -87
- package/esm2020/browser/style.mjs +37 -37
- package/esm2020/config/abc/date-picker.type.mjs +1 -1
- package/esm2020/config/abc/error-collect.type.mjs +1 -1
- package/esm2020/config/abc/exception.type.mjs +1 -1
- package/esm2020/config/abc/image.type.mjs +1 -1
- package/esm2020/config/abc/index.mjs +17 -17
- package/esm2020/config/abc/loading.type.mjs +1 -1
- package/esm2020/config/abc/lodop.type.mjs +1 -1
- package/esm2020/config/abc/media.type.mjs +1 -1
- package/esm2020/config/abc/onboarding.type.mjs +1 -1
- package/esm2020/config/abc/page-header.type.mjs +1 -1
- package/esm2020/config/abc/pdf.type.mjs +1 -1
- package/esm2020/config/abc/qr.type.mjs +1 -1
- package/esm2020/config/abc/se.type.mjs +1 -1
- package/esm2020/config/abc/sg.type.mjs +1 -1
- package/esm2020/config/abc/st.type.mjs +1 -1
- package/esm2020/config/abc/sv.type.mjs +2 -2
- package/esm2020/config/abc/xlsx.type.mjs +1 -1
- package/esm2020/config/abc/zip.type.mjs +1 -1
- package/esm2020/config/acl/acl.type.mjs +1 -1
- package/esm2020/config/auth/auth.type.mjs +1 -1
- package/esm2020/config/bis/bis.type.mjs +1 -1
- package/esm2020/config/cache/cache.type.mjs +1 -1
- package/esm2020/config/chart/chart.type.mjs +1 -1
- package/esm2020/config/config.mjs +4 -4
- package/esm2020/config/config.service.mjs +36 -36
- package/esm2020/config/config.types.mjs +8 -8
- package/esm2020/config/index.mjs +14 -14
- package/esm2020/config/mock/mock.type.mjs +1 -1
- package/esm2020/config/sf/sf.type.mjs +1 -1
- package/esm2020/config/socket/socket.type.mjs +1 -1
- package/esm2020/config/theme/http.type.mjs +1 -1
- package/esm2020/config/theme/i18n.type.mjs +1 -1
- package/esm2020/config/theme/index.mjs +3 -3
- package/esm2020/config/theme/responsive.type.mjs +1 -1
- package/esm2020/config/util/array.type.mjs +1 -1
- package/esm2020/config/util/currency.type.mjs +1 -1
- package/esm2020/date-time/date-time.mjs +4 -4
- package/esm2020/date-time/index.mjs +2 -2
- package/esm2020/date-time/picker.mjs +115 -115
- package/esm2020/date-time/time.mjs +88 -88
- package/esm2020/decorator/convert.mjs +57 -57
- package/esm2020/decorator/decorator.mjs +4 -4
- package/esm2020/decorator/index.mjs +2 -2
- package/esm2020/decorator/zone-outside.mjs +56 -56
- package/esm2020/form/form.mjs +4 -4
- package/esm2020/form/index.mjs +2 -2
- package/esm2020/form/match-control.mjs +29 -29
- package/esm2020/form/validators.mjs +80 -80
- package/esm2020/format/currency.service.mjs +237 -237
- package/esm2020/format/currency.types.mjs +7 -7
- package/esm2020/format/format.mjs +4 -4
- package/esm2020/format/index.mjs +4 -4
- package/esm2020/format/string.mjs +84 -84
- package/esm2020/format/validate.mjs +93 -93
- package/esm2020/index.mjs +11 -11
- package/esm2020/math/in-range.mjs +24 -24
- package/esm2020/math/index.mjs +2 -2
- package/esm2020/math/math.mjs +4 -4
- package/esm2020/math/round.mjs +52 -52
- package/esm2020/other/assert.mjs +66 -66
- package/esm2020/other/deep.mjs +78 -76
- package/esm2020/other/favicon.mjs +28 -28
- package/esm2020/other/index.mjs +7 -7
- package/esm2020/other/lazy.service.mjs +131 -131
- package/esm2020/other/logger.mjs +32 -32
- package/esm2020/other/other.mjs +4 -4
- package/esm2020/other/path-to-regexp.service.mjs +238 -238
- package/esm2020/other/resize.mjs +3 -3
- package/esm2020/pipes/currency/cny.pipe.mjs +22 -22
- package/esm2020/pipes/currency/index.mjs +4 -4
- package/esm2020/pipes/currency/mega.pipe.mjs +28 -28
- package/esm2020/pipes/currency/module.mjs +18 -18
- package/esm2020/pipes/currency/pipe-currency.mjs +4 -4
- package/esm2020/pipes/currency/price.pipe.mjs +26 -26
- package/esm2020/pipes/filter/filter.pipe.mjs +18 -18
- package/esm2020/pipes/filter/index.mjs +2 -2
- package/esm2020/pipes/filter/module.mjs +16 -16
- package/esm2020/pipes/filter/pipe-filter.mjs +4 -4
- package/esm2020/pipes/format/index.mjs +2 -2
- package/esm2020/pipes/format/mask.pipe.mjs +33 -33
- package/esm2020/pipes/format/module.mjs +16 -16
- package/esm2020/pipes/format/pipe-format.mjs +4 -4
- package/esm2020/pipes/index.mjs +3 -3
- package/esm2020/pipes/pipes.mjs +4 -4
- package/esm2020/token/index.mjs +2 -2
- package/esm2020/token/page-visibility.mjs +14 -14
- package/esm2020/token/token.mjs +4 -4
- package/esm2020/token/window.mjs +16 -16
- package/esm2020/yelon-util.mjs +4 -4
- package/fesm2015/array.mjs +254 -254
- package/fesm2015/browser.mjs +283 -283
- package/fesm2015/config.mjs +56 -56
- package/fesm2015/date-time.mjs +207 -207
- package/fesm2015/decorator.mjs +121 -121
- package/fesm2015/form.mjs +118 -118
- package/fesm2015/format.mjs +413 -413
- package/fesm2015/math.mjs +85 -85
- package/fesm2015/other.mjs +589 -587
- package/fesm2015/other.mjs.map +1 -1
- package/fesm2015/pipe-currency.mjs +96 -96
- package/fesm2015/pipe-filter.mjs +40 -40
- package/fesm2015/pipe-format.mjs +55 -55
- package/fesm2015/pipes.mjs +8 -8
- package/fesm2015/token.mjs +37 -37
- package/fesm2015/yelon-util.mjs +16 -16
- package/fesm2020/array.mjs +284 -284
- package/fesm2020/browser.mjs +279 -279
- package/fesm2020/config.mjs +54 -54
- package/fesm2020/date-time.mjs +211 -211
- package/fesm2020/decorator.mjs +121 -121
- package/fesm2020/form.mjs +118 -118
- package/fesm2020/format.mjs +431 -431
- package/fesm2020/math.mjs +85 -85
- package/fesm2020/other.mjs +586 -584
- package/fesm2020/other.mjs.map +1 -1
- package/fesm2020/pipe-currency.mjs +94 -94
- package/fesm2020/pipe-filter.mjs +40 -40
- package/fesm2020/pipe-format.mjs +55 -55
- package/fesm2020/pipes.mjs +8 -8
- package/fesm2020/token.mjs +37 -37
- package/fesm2020/yelon-util.mjs +16 -16
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/format/currency.service.d.ts +37 -37
- package/format/currency.types.d.ts +77 -77
- package/format/index.d.ts +4 -4
- package/format/string.d.ts +44 -44
- package/format/validate.d.ts +72 -72
- package/index.d.ts +11 -11
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +35 -33
- package/other/favicon.d.ts +2 -2
- package/other/index.d.ts +7 -7
- package/other/lazy.service.d.ts +48 -48
- package/other/logger.d.ts +5 -5
- package/other/path-to-regexp.service.d.ts +26 -26
- package/other/resize.d.ts +1 -1
- package/package.json +157 -157
- package/pipes/currency/cny.pipe.d.ts +15 -15
- package/pipes/currency/index.d.ts +4 -4
- package/pipes/currency/mega.pipe.d.ts +16 -16
- package/pipes/currency/module.d.ts +9 -9
- package/pipes/currency/price.pipe.d.ts +19 -19
- package/pipes/filter/filter.pipe.d.ts +13 -13
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +7 -7
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +27 -27
- package/pipes/format/module.d.ts +7 -7
- package/pipes/index.d.ts +3 -3
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
package/fesm2015/other.mjs
CHANGED
@@ -1,587 +1,589 @@
|
|
1
|
-
import extend from 'extend';
|
2
|
-
import { DOCUMENT } from '@angular/common';
|
3
|
-
import * as i0 from '@angular/core';
|
4
|
-
import { Injectable, Inject } from '@angular/core';
|
5
|
-
import { BehaviorSubject, share, filter, isObservable } from 'rxjs';
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Gets the value at `path` of `object`, like `_.get` in lodash.
|
9
|
-
*
|
10
|
-
* 类似 `_.get`,根据 `path` 获取安全值
|
11
|
-
*/
|
12
|
-
function deepGet(obj, path, defaultValue) {
|
13
|
-
if (!obj || path == null || path.length === 0)
|
14
|
-
return defaultValue;
|
15
|
-
if (!Array.isArray(path)) {
|
16
|
-
path = ~path.indexOf('.') ? path.split('.') : [path];
|
17
|
-
}
|
18
|
-
if (path.length === 1) {
|
19
|
-
const checkObj = obj[path[0]];
|
20
|
-
return typeof checkObj === 'undefined' ? defaultValue : checkObj;
|
21
|
-
}
|
22
|
-
const res = path.reduce((o, k) => (o || {})[k], obj);
|
23
|
-
return typeof res === 'undefined' ? defaultValue : res;
|
24
|
-
}
|
25
|
-
/**
|
26
|
-
* Base on [extend](https://github.com/justmoon/node-extend) deep copy.
|
27
|
-
*
|
28
|
-
* 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
*
|
38
|
-
*
|
39
|
-
*
|
40
|
-
*
|
41
|
-
*
|
42
|
-
*
|
43
|
-
*
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
*
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
*
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
this.
|
125
|
-
this.
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
this.
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
node
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
node
|
219
|
-
node.
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
|
236
|
-
i0.ɵɵ
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
}
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
*
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
*
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
*
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
*
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
*
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
*
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
let
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
const
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
const
|
347
|
-
const
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
const
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
const
|
366
|
-
const
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
const
|
484
|
-
const
|
485
|
-
const
|
486
|
-
|
487
|
-
|
488
|
-
.concat(
|
489
|
-
.
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
}
|
544
|
-
|
545
|
-
|
546
|
-
i0.ɵɵ
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
function
|
554
|
-
|
555
|
-
|
556
|
-
link
|
557
|
-
link.
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
}
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
1
|
+
import extend from 'extend';
|
2
|
+
import { DOCUMENT } from '@angular/common';
|
3
|
+
import * as i0 from '@angular/core';
|
4
|
+
import { Injectable, Inject } from '@angular/core';
|
5
|
+
import { BehaviorSubject, share, filter, isObservable } from 'rxjs';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Gets the value at `path` of `object`, like `_.get` in lodash.
|
9
|
+
*
|
10
|
+
* 类似 `_.get`,根据 `path` 获取安全值
|
11
|
+
*/
|
12
|
+
function deepGet(obj, path, defaultValue) {
|
13
|
+
if (!obj || path == null || path.length === 0)
|
14
|
+
return defaultValue;
|
15
|
+
if (!Array.isArray(path)) {
|
16
|
+
path = ~path.indexOf('.') ? path.split('.') : [path];
|
17
|
+
}
|
18
|
+
if (path.length === 1) {
|
19
|
+
const checkObj = obj[path[0]];
|
20
|
+
return typeof checkObj === 'undefined' ? defaultValue : checkObj;
|
21
|
+
}
|
22
|
+
const res = path.reduce((o, k) => (o || {})[k], obj);
|
23
|
+
return typeof res === 'undefined' ? defaultValue : res;
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
* Base on [extend](https://github.com/justmoon/node-extend) deep copy.
|
27
|
+
*
|
28
|
+
* 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝
|
29
|
+
*
|
30
|
+
* NOTE: Don't a lot of recursion, maybe performance issues
|
31
|
+
*/
|
32
|
+
function deepCopy(obj) {
|
33
|
+
const result = extend(true, {}, { _: obj });
|
34
|
+
return result._;
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Deep merge object.
|
38
|
+
*
|
39
|
+
* 深度合并对象
|
40
|
+
*
|
41
|
+
* @param original 原始对象
|
42
|
+
* @param arrayProcessMethod 数组处理方式
|
43
|
+
* - `true` 表示替换新值,不管新值为哪种类型
|
44
|
+
* - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)
|
45
|
+
* @param objects 要合并的对象
|
46
|
+
*/
|
47
|
+
function deepMergeKey(original, arrayProcessMethod, ...objects) {
|
48
|
+
if (Array.isArray(original) || typeof original !== 'object')
|
49
|
+
return original;
|
50
|
+
const isObject = (v) => typeof v === 'object';
|
51
|
+
const merge = (target, obj) => {
|
52
|
+
Object.keys(obj)
|
53
|
+
.filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))
|
54
|
+
.forEach(key => {
|
55
|
+
const fromValue = obj[key];
|
56
|
+
const toValue = target[key];
|
57
|
+
if (Array.isArray(toValue)) {
|
58
|
+
target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];
|
59
|
+
}
|
60
|
+
else if (typeof fromValue === 'function') {
|
61
|
+
target[key] = fromValue;
|
62
|
+
}
|
63
|
+
else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {
|
64
|
+
target[key] = merge(toValue, fromValue);
|
65
|
+
}
|
66
|
+
else {
|
67
|
+
target[key] = deepCopy(fromValue);
|
68
|
+
}
|
69
|
+
});
|
70
|
+
return target;
|
71
|
+
};
|
72
|
+
objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));
|
73
|
+
return original;
|
74
|
+
}
|
75
|
+
/**
|
76
|
+
* Deep merge object.
|
77
|
+
*
|
78
|
+
* 深度合并对象
|
79
|
+
*/
|
80
|
+
function deepMerge(original, ...objects) {
|
81
|
+
return deepMergeKey(original, false, ...objects);
|
82
|
+
}
|
83
|
+
|
84
|
+
const record = {};
|
85
|
+
const PREFIX = '[@YELON]:';
|
86
|
+
function notRecorded(...args) {
|
87
|
+
const asRecord = args.reduce((acc, c) => acc + c.toString(), '');
|
88
|
+
if (record[asRecord]) {
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
record[asRecord] = true;
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
function consoleCommonBehavior(consoleFunc, ...args) {
|
97
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && notRecorded(...args)) {
|
98
|
+
consoleFunc(...args);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
// Warning should only be printed in dev mode and only once.
|
102
|
+
const warn = (...args) => consoleCommonBehavior((...arg) => console.warn(PREFIX, ...arg), ...args);
|
103
|
+
const warnDeprecation = (...args) => {
|
104
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
105
|
+
return () => { };
|
106
|
+
}
|
107
|
+
const stack = new Error().stack;
|
108
|
+
return consoleCommonBehavior((...arg) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);
|
109
|
+
};
|
110
|
+
// Log should only be printed in dev mode.
|
111
|
+
const log = (...args) => {
|
112
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
113
|
+
console.log(PREFIX, ...args);
|
114
|
+
}
|
115
|
+
};
|
116
|
+
|
117
|
+
/**
|
118
|
+
* `LazyService` delay loading JS or CSS files.
|
119
|
+
*
|
120
|
+
* 延迟加载资源(js 或 css)服务
|
121
|
+
*/
|
122
|
+
class LazyService {
|
123
|
+
constructor(doc) {
|
124
|
+
this.doc = doc;
|
125
|
+
this.list = {};
|
126
|
+
this.cached = {};
|
127
|
+
this._notify = new BehaviorSubject([]);
|
128
|
+
}
|
129
|
+
get change() {
|
130
|
+
return this._notify.asObservable().pipe(share(), filter(ls => ls.length !== 0));
|
131
|
+
}
|
132
|
+
clear() {
|
133
|
+
this.list = {};
|
134
|
+
this.cached = {};
|
135
|
+
}
|
136
|
+
attachAttributes(el, attributes) {
|
137
|
+
if (attributes == null)
|
138
|
+
return;
|
139
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
140
|
+
el.setAttribute(key, value);
|
141
|
+
});
|
142
|
+
}
|
143
|
+
/**
|
144
|
+
* Load script or style files
|
145
|
+
*/
|
146
|
+
load(paths) {
|
147
|
+
if (!Array.isArray(paths)) {
|
148
|
+
paths = [paths];
|
149
|
+
}
|
150
|
+
const promises = [];
|
151
|
+
paths
|
152
|
+
.map(v => (typeof v !== 'object' ? { path: v } : v))
|
153
|
+
.forEach(item => {
|
154
|
+
if (item.path.endsWith('.js')) {
|
155
|
+
promises.push(this.loadScript(item.path, item.options));
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
promises.push(this.loadStyle(item.path, item.options));
|
159
|
+
}
|
160
|
+
});
|
161
|
+
return Promise.all(promises).then(res => {
|
162
|
+
this._notify.next(res);
|
163
|
+
return Promise.resolve(res);
|
164
|
+
});
|
165
|
+
}
|
166
|
+
loadScript(path, innerContent, attributes) {
|
167
|
+
const options = typeof innerContent === 'object'
|
168
|
+
? innerContent
|
169
|
+
: {
|
170
|
+
innerContent,
|
171
|
+
attributes
|
172
|
+
};
|
173
|
+
return new Promise(resolve => {
|
174
|
+
if (this.list[path] === true) {
|
175
|
+
resolve(Object.assign(Object.assign({}, this.cached[path]), { status: 'loading' }));
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
this.list[path] = true;
|
179
|
+
const onSuccess = (item) => {
|
180
|
+
this.cached[path] = item;
|
181
|
+
resolve(item);
|
182
|
+
this._notify.next([item]);
|
183
|
+
};
|
184
|
+
const node = this.doc.createElement('script');
|
185
|
+
node.type = 'text/javascript';
|
186
|
+
node.src = path;
|
187
|
+
this.attachAttributes(node, options.attributes);
|
188
|
+
if (options.innerContent) {
|
189
|
+
node.innerHTML = options.innerContent;
|
190
|
+
}
|
191
|
+
node.onload = () => onSuccess({
|
192
|
+
path,
|
193
|
+
status: 'ok'
|
194
|
+
});
|
195
|
+
node.onerror = error => onSuccess({
|
196
|
+
path,
|
197
|
+
status: 'error',
|
198
|
+
error
|
199
|
+
});
|
200
|
+
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
201
|
+
});
|
202
|
+
}
|
203
|
+
loadStyle(path, rel, innerContent, attributes) {
|
204
|
+
const options = typeof rel === 'object'
|
205
|
+
? rel
|
206
|
+
: {
|
207
|
+
rel,
|
208
|
+
innerContent,
|
209
|
+
attributes
|
210
|
+
};
|
211
|
+
return new Promise(resolve => {
|
212
|
+
var _a;
|
213
|
+
if (this.list[path] === true) {
|
214
|
+
resolve(this.cached[path]);
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
this.list[path] = true;
|
218
|
+
const node = this.doc.createElement('link');
|
219
|
+
node.rel = (_a = options.rel) !== null && _a !== void 0 ? _a : 'stylesheet';
|
220
|
+
node.type = 'text/css';
|
221
|
+
node.href = path;
|
222
|
+
this.attachAttributes(node, options.attributes);
|
223
|
+
if (options.innerContent) {
|
224
|
+
node.innerHTML = options.innerContent;
|
225
|
+
}
|
226
|
+
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
227
|
+
const item = {
|
228
|
+
path,
|
229
|
+
status: 'ok'
|
230
|
+
};
|
231
|
+
this.cached[path] = item;
|
232
|
+
resolve(item);
|
233
|
+
});
|
234
|
+
}
|
235
|
+
}
|
236
|
+
LazyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LazyService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
237
|
+
LazyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LazyService, providedIn: 'root' });
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LazyService, decorators: [{
|
239
|
+
type: Injectable,
|
240
|
+
args: [{ providedIn: 'root' }]
|
241
|
+
}], ctorParameters: function () {
|
242
|
+
return [{ type: undefined, decorators: [{
|
243
|
+
type: Inject,
|
244
|
+
args: [DOCUMENT]
|
245
|
+
}] }];
|
246
|
+
} });
|
247
|
+
|
248
|
+
function throwError(msg, actual, expected, comparison) {
|
249
|
+
if (ngDevMode) {
|
250
|
+
throw new Error(`ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
/**
|
254
|
+
* Assert whether the expression and throw an error into console in dev mode
|
255
|
+
*
|
256
|
+
* 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误
|
257
|
+
*/
|
258
|
+
function assert(expression, msg) {
|
259
|
+
if (!expression) {
|
260
|
+
throwError(msg);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
/**
|
264
|
+
* Assert whether empty (`null` or `undefined`)
|
265
|
+
*
|
266
|
+
* 断言是否空值(`null` 或 `undefined`)
|
267
|
+
*/
|
268
|
+
function assertEmpty(actual, msg) {
|
269
|
+
if (actual == null) {
|
270
|
+
throwError(msg, typeof actual, 'NULL', '==');
|
271
|
+
}
|
272
|
+
}
|
273
|
+
/**
|
274
|
+
* Assert whether `number` type
|
275
|
+
*
|
276
|
+
* 断言是否 `number` 类型
|
277
|
+
*/
|
278
|
+
function assertNumber(actual, msg) {
|
279
|
+
if (!(typeof actual === 'number')) {
|
280
|
+
throwError(msg, typeof actual, 'number', '===');
|
281
|
+
}
|
282
|
+
}
|
283
|
+
/**
|
284
|
+
* Assert whether `string` type
|
285
|
+
*
|
286
|
+
* 断言是否 `string` 类型
|
287
|
+
*/
|
288
|
+
function assertString(actual, msg) {
|
289
|
+
if (!(typeof actual === 'string')) {
|
290
|
+
throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
|
291
|
+
}
|
292
|
+
}
|
293
|
+
/**
|
294
|
+
* Assert whether `array` type
|
295
|
+
*
|
296
|
+
* 断言是否 `array` 类型
|
297
|
+
*/
|
298
|
+
function assertArray(actual, msg) {
|
299
|
+
if (!Array.isArray(actual)) {
|
300
|
+
throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');
|
301
|
+
}
|
302
|
+
}
|
303
|
+
/**
|
304
|
+
* Assert whether `Observable` type
|
305
|
+
*
|
306
|
+
* 断言是否 `Observable` 类型
|
307
|
+
*/
|
308
|
+
function assertObservable(obj, msg) {
|
309
|
+
if (!isObservable(obj)) {
|
310
|
+
throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
const resizeWindow = () => {
|
315
|
+
window.dispatchEvent(new Event('resize'));
|
316
|
+
};
|
317
|
+
|
318
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
319
|
+
class PathToRegexpService {
|
320
|
+
constructor() {
|
321
|
+
this.DEFAULT_DELIMITER = '/';
|
322
|
+
this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
|
323
|
+
}
|
324
|
+
parse(str, options) {
|
325
|
+
const tokens = [];
|
326
|
+
let key = 0;
|
327
|
+
let index = 0;
|
328
|
+
let path = '';
|
329
|
+
const defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
|
330
|
+
const whitelist = (options && options.whitelist) || undefined;
|
331
|
+
let pathEscaped = false;
|
332
|
+
let res;
|
333
|
+
while ((res = this.PATH_REGEXP.exec(str)) !== null) {
|
334
|
+
const m = res[0];
|
335
|
+
const escaped = res[1];
|
336
|
+
const offset = res.index;
|
337
|
+
path += str.slice(index, offset);
|
338
|
+
index = offset + m.length;
|
339
|
+
// Ignore already escaped sequences.
|
340
|
+
if (escaped) {
|
341
|
+
path += escaped[1];
|
342
|
+
pathEscaped = true;
|
343
|
+
continue;
|
344
|
+
}
|
345
|
+
let prev = '';
|
346
|
+
const name = res[2];
|
347
|
+
const capture = res[3];
|
348
|
+
const group = res[4];
|
349
|
+
const modifier = res[5];
|
350
|
+
if (!pathEscaped && path.length) {
|
351
|
+
const k = path.length - 1;
|
352
|
+
const c = path[k];
|
353
|
+
const matches = whitelist ? whitelist.indexOf(c) > -1 : true;
|
354
|
+
if (matches) {
|
355
|
+
prev = c;
|
356
|
+
path = path.slice(0, k);
|
357
|
+
}
|
358
|
+
}
|
359
|
+
// Push the current path onto the tokens.
|
360
|
+
if (path) {
|
361
|
+
tokens.push(path);
|
362
|
+
path = '';
|
363
|
+
pathEscaped = false;
|
364
|
+
}
|
365
|
+
const repeat = modifier === '+' || modifier === '*';
|
366
|
+
const optional = modifier === '?' || modifier === '*';
|
367
|
+
const pattern = capture || group;
|
368
|
+
const delimiter = prev || defaultDelimiter;
|
369
|
+
tokens.push({
|
370
|
+
name: name || key++,
|
371
|
+
prefix: prev,
|
372
|
+
delimiter: delimiter,
|
373
|
+
optional: optional,
|
374
|
+
repeat: repeat,
|
375
|
+
pattern: pattern
|
376
|
+
? this.escapeGroup(pattern)
|
377
|
+
: `[^${this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter)}]+?`
|
378
|
+
});
|
379
|
+
}
|
380
|
+
// Push any remaining characters.
|
381
|
+
if (path || index < str.length) {
|
382
|
+
tokens.push(path + str.substr(index));
|
383
|
+
}
|
384
|
+
return tokens;
|
385
|
+
}
|
386
|
+
compile(str, options) {
|
387
|
+
return this.tokensToFunction(this.parse(str, options), options);
|
388
|
+
}
|
389
|
+
tokensToFunction(tokens, options) {
|
390
|
+
const matches = new Array(tokens.length);
|
391
|
+
for (let i = 0; i < tokens.length; i++) {
|
392
|
+
if (typeof tokens[i] === 'object') {
|
393
|
+
matches[i] = new RegExp(`^(?:${tokens[i].pattern})$`, this.flags(options));
|
394
|
+
}
|
395
|
+
}
|
396
|
+
return function (data, options) {
|
397
|
+
let path = '';
|
398
|
+
const encode = (options && options.encode) || encodeURIComponent;
|
399
|
+
const validate = options ? options.validate !== false : true;
|
400
|
+
for (let i = 0; i < tokens.length; i++) {
|
401
|
+
const token = tokens[i];
|
402
|
+
if (typeof token === 'string') {
|
403
|
+
path += token;
|
404
|
+
continue;
|
405
|
+
}
|
406
|
+
const value = data ? data[token.name] : undefined;
|
407
|
+
let segment;
|
408
|
+
if (Array.isArray(value)) {
|
409
|
+
if (!token.repeat) {
|
410
|
+
throw new TypeError(`Expected "${token.name}" to not repeat, but got array`);
|
411
|
+
}
|
412
|
+
if (value.length === 0) {
|
413
|
+
if (token.optional) {
|
414
|
+
continue;
|
415
|
+
}
|
416
|
+
throw new TypeError(`Expected "${token.name}" to not be empty`);
|
417
|
+
}
|
418
|
+
for (let j = 0; j < value.length; j++) {
|
419
|
+
segment = encode(value[j], token);
|
420
|
+
if (validate && !matches[i].test(segment)) {
|
421
|
+
throw new TypeError(`Expected all "${token.name}" to match "${token.pattern}"`);
|
422
|
+
}
|
423
|
+
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
424
|
+
}
|
425
|
+
continue;
|
426
|
+
}
|
427
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
428
|
+
segment = encode(String(value), token);
|
429
|
+
if (validate && !matches[i].test(segment)) {
|
430
|
+
throw new TypeError(`Expected "${token.name}" to match "${token.pattern}", but got "${segment}"`);
|
431
|
+
}
|
432
|
+
path += token.prefix + segment;
|
433
|
+
continue;
|
434
|
+
}
|
435
|
+
if (token.optional) {
|
436
|
+
continue;
|
437
|
+
}
|
438
|
+
throw new TypeError(`Expected "${token.name}" to be ${token.repeat ? 'an array' : 'a string'}`);
|
439
|
+
}
|
440
|
+
return path;
|
441
|
+
};
|
442
|
+
}
|
443
|
+
escapeString(str) {
|
444
|
+
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
|
445
|
+
}
|
446
|
+
escapeGroup(group) {
|
447
|
+
return group.replace(/([=!:$/()])/g, '\\$1');
|
448
|
+
}
|
449
|
+
flags(options) {
|
450
|
+
return options && options.sensitive ? '' : 'i';
|
451
|
+
}
|
452
|
+
regexpToRegexp(path, keys) {
|
453
|
+
if (!keys) {
|
454
|
+
return path;
|
455
|
+
}
|
456
|
+
const groups = path.source.match(/\((?!\?)/g);
|
457
|
+
if (groups) {
|
458
|
+
for (let i = 0; i < groups.length; i++) {
|
459
|
+
keys.push({
|
460
|
+
name: i,
|
461
|
+
prefix: null,
|
462
|
+
delimiter: null,
|
463
|
+
optional: false,
|
464
|
+
repeat: false,
|
465
|
+
pattern: null
|
466
|
+
});
|
467
|
+
}
|
468
|
+
}
|
469
|
+
return path;
|
470
|
+
}
|
471
|
+
arrayToRegexp(path, keys, options) {
|
472
|
+
const parts = [];
|
473
|
+
for (let i = 0; i < path.length; i++) {
|
474
|
+
parts.push(this.pathToRegexp(path[i], keys, options).source);
|
475
|
+
}
|
476
|
+
return new RegExp(`(?:${parts.join('|')})`, this.flags(options));
|
477
|
+
}
|
478
|
+
stringToRegexp(path, keys, options) {
|
479
|
+
return this.tokensToRegExp(this.parse(path, options), keys, options);
|
480
|
+
}
|
481
|
+
tokensToRegExp(tokens, keys, options) {
|
482
|
+
options = options || {};
|
483
|
+
const strict = options.strict;
|
484
|
+
const start = options.start !== false;
|
485
|
+
const end = options.end !== false;
|
486
|
+
const delimiter = options.delimiter || this.DEFAULT_DELIMITER;
|
487
|
+
const endsWith = []
|
488
|
+
.concat(options.endsWith || [])
|
489
|
+
.map(this.escapeString)
|
490
|
+
.concat('$')
|
491
|
+
.join('|');
|
492
|
+
let route = start ? '^' : '';
|
493
|
+
for (let i = 0; i < tokens.length; i++) {
|
494
|
+
const token = tokens[i];
|
495
|
+
if (typeof token === 'string') {
|
496
|
+
route += this.escapeString(token);
|
497
|
+
}
|
498
|
+
else {
|
499
|
+
const capture = token.repeat
|
500
|
+
? `(?:${token.pattern})(?:${this.escapeString(token.delimiter)}(?:${token.pattern}))*`
|
501
|
+
: token.pattern;
|
502
|
+
if (keys) {
|
503
|
+
keys.push(token);
|
504
|
+
}
|
505
|
+
if (token.optional) {
|
506
|
+
if (!token.prefix) {
|
507
|
+
route += `(${capture})?`;
|
508
|
+
}
|
509
|
+
else {
|
510
|
+
route += `(?:${this.escapeString(token.prefix)}(${capture}))?`;
|
511
|
+
}
|
512
|
+
}
|
513
|
+
else {
|
514
|
+
route += `${this.escapeString(token.prefix)}(${capture})`;
|
515
|
+
}
|
516
|
+
}
|
517
|
+
}
|
518
|
+
if (end) {
|
519
|
+
if (!strict) {
|
520
|
+
route += `(?:${this.escapeString(delimiter)})?`;
|
521
|
+
}
|
522
|
+
route += endsWith === '$' ? '$' : `(?=${endsWith})`;
|
523
|
+
}
|
524
|
+
else {
|
525
|
+
const endToken = tokens[tokens.length - 1];
|
526
|
+
const isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
|
527
|
+
if (!strict) {
|
528
|
+
route += `(?:${this.escapeString(delimiter)}(?=${endsWith}))?`;
|
529
|
+
}
|
530
|
+
if (!isEndDelimited) {
|
531
|
+
route += `(?=${this.escapeString(delimiter)}|${endsWith})`;
|
532
|
+
}
|
533
|
+
}
|
534
|
+
return new RegExp(route, this.flags(options));
|
535
|
+
}
|
536
|
+
pathToRegexp(path, keys, options) {
|
537
|
+
if (path instanceof RegExp) {
|
538
|
+
return this.regexpToRegexp(path, keys);
|
539
|
+
}
|
540
|
+
if (Array.isArray(path)) {
|
541
|
+
return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
|
542
|
+
}
|
543
|
+
return this.stringToRegexp(/** @type {string} */ path, keys, options);
|
544
|
+
}
|
545
|
+
}
|
546
|
+
PathToRegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PathToRegexpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
547
|
+
PathToRegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PathToRegexpService, providedIn: 'root' });
|
548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PathToRegexpService, decorators: [{
|
549
|
+
type: Injectable,
|
550
|
+
args: [{
|
551
|
+
providedIn: 'root'
|
552
|
+
}]
|
553
|
+
}], ctorParameters: function () { return []; } });
|
554
|
+
|
555
|
+
function setFavicon(path) {
|
556
|
+
const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
557
|
+
link.type = 'image/x-icon';
|
558
|
+
link.rel = 'shortcut icon';
|
559
|
+
link.href = path;
|
560
|
+
document.getElementsByTagName('head')[0].appendChild(link);
|
561
|
+
}
|
562
|
+
function hasFavicon(url) {
|
563
|
+
return new Promise(resolve => {
|
564
|
+
let xmlHttp;
|
565
|
+
if (window['XMLHttpRequest']) {
|
566
|
+
xmlHttp = new XMLHttpRequest();
|
567
|
+
}
|
568
|
+
if (xmlHttp) {
|
569
|
+
xmlHttp.open('Get', url, false);
|
570
|
+
xmlHttp.send();
|
571
|
+
if (xmlHttp.status == 404) {
|
572
|
+
resolve(false);
|
573
|
+
}
|
574
|
+
else {
|
575
|
+
resolve(true);
|
576
|
+
}
|
577
|
+
}
|
578
|
+
else {
|
579
|
+
resolve(false);
|
580
|
+
}
|
581
|
+
});
|
582
|
+
}
|
583
|
+
|
584
|
+
/**
|
585
|
+
* Generated bundle index. Do not edit.
|
586
|
+
*/
|
587
|
+
|
588
|
+
export { LazyService, PREFIX, PathToRegexpService, assert, assertArray, assertEmpty, assertNumber, assertObservable, assertString, deepCopy, deepGet, deepMerge, deepMergeKey, hasFavicon, log, resizeWindow, setFavicon, warn, warnDeprecation };
|
589
|
+
//# sourceMappingURL=other.mjs.map
|