source: trip-planner-front/node_modules/@angular/router/esm2015/src/url_tree.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 70.6 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { convertToParamMap, PRIMARY_OUTLET } from './shared';
9import { equalArraysOrString, forEach, shallowEqual } from './utils/collection';
10export function createEmptyUrlTree() {
11 return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
12}
13const pathCompareMap = {
14 'exact': equalSegmentGroups,
15 'subset': containsSegmentGroup,
16};
17const paramCompareMap = {
18 'exact': equalParams,
19 'subset': containsParams,
20 'ignored': () => true,
21};
22export function containsTree(container, containee, options) {
23 return pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) &&
24 paramCompareMap[options.queryParams](container.queryParams, containee.queryParams) &&
25 !(options.fragment === 'exact' && container.fragment !== containee.fragment);
26}
27function equalParams(container, containee) {
28 // TODO: This does not handle array params correctly.
29 return shallowEqual(container, containee);
30}
31function equalSegmentGroups(container, containee, matrixParams) {
32 if (!equalPath(container.segments, containee.segments))
33 return false;
34 if (!matrixParamsMatch(container.segments, containee.segments, matrixParams)) {
35 return false;
36 }
37 if (container.numberOfChildren !== containee.numberOfChildren)
38 return false;
39 for (const c in containee.children) {
40 if (!container.children[c])
41 return false;
42 if (!equalSegmentGroups(container.children[c], containee.children[c], matrixParams))
43 return false;
44 }
45 return true;
46}
47function containsParams(container, containee) {
48 return Object.keys(containee).length <= Object.keys(container).length &&
49 Object.keys(containee).every(key => equalArraysOrString(container[key], containee[key]));
50}
51function containsSegmentGroup(container, containee, matrixParams) {
52 return containsSegmentGroupHelper(container, containee, containee.segments, matrixParams);
53}
54function containsSegmentGroupHelper(container, containee, containeePaths, matrixParams) {
55 if (container.segments.length > containeePaths.length) {
56 const current = container.segments.slice(0, containeePaths.length);
57 if (!equalPath(current, containeePaths))
58 return false;
59 if (containee.hasChildren())
60 return false;
61 if (!matrixParamsMatch(current, containeePaths, matrixParams))
62 return false;
63 return true;
64 }
65 else if (container.segments.length === containeePaths.length) {
66 if (!equalPath(container.segments, containeePaths))
67 return false;
68 if (!matrixParamsMatch(container.segments, containeePaths, matrixParams))
69 return false;
70 for (const c in containee.children) {
71 if (!container.children[c])
72 return false;
73 if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) {
74 return false;
75 }
76 }
77 return true;
78 }
79 else {
80 const current = containeePaths.slice(0, container.segments.length);
81 const next = containeePaths.slice(container.segments.length);
82 if (!equalPath(container.segments, current))
83 return false;
84 if (!matrixParamsMatch(container.segments, current, matrixParams))
85 return false;
86 if (!container.children[PRIMARY_OUTLET])
87 return false;
88 return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next, matrixParams);
89 }
90}
91function matrixParamsMatch(containerPaths, containeePaths, options) {
92 return containeePaths.every((containeeSegment, i) => {
93 return paramCompareMap[options](containerPaths[i].parameters, containeeSegment.parameters);
94 });
95}
96/**
97 * @description
98 *
99 * Represents the parsed URL.
100 *
101 * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a
102 * serialized tree.
103 * UrlTree is a data structure that provides a lot of affordances in dealing with URLs
104 *
105 * @usageNotes
106 * ### Example
107 *
108 * ```
109 * @Component({templateUrl:'template.html'})
110 * class MyComponent {
111 * constructor(router: Router) {
112 * const tree: UrlTree =
113 * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');
114 * const f = tree.fragment; // return 'fragment'
115 * const q = tree.queryParams; // returns {debug: 'true'}
116 * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
117 * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'
118 * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'
119 * g.children['support'].segments; // return 1 segment 'help'
120 * }
121 * }
122 * ```
123 *
124 * @publicApi
125 */
126export class UrlTree {
127 /** @internal */
128 constructor(
129 /** The root segment group of the URL tree */
130 root,
131 /** The query params of the URL */
132 queryParams,
133 /** The fragment of the URL */
134 fragment) {
135 this.root = root;
136 this.queryParams = queryParams;
137 this.fragment = fragment;
138 }
139 get queryParamMap() {
140 if (!this._queryParamMap) {
141 this._queryParamMap = convertToParamMap(this.queryParams);
142 }
143 return this._queryParamMap;
144 }
145 /** @docsNotRequired */
146 toString() {
147 return DEFAULT_SERIALIZER.serialize(this);
148 }
149}
150/**
151 * @description
152 *
153 * Represents the parsed URL segment group.
154 *
155 * See `UrlTree` for more information.
156 *
157 * @publicApi
158 */
159export class UrlSegmentGroup {
160 constructor(
161 /** The URL segments of this group. See `UrlSegment` for more information */
162 segments,
163 /** The list of children of this group */
164 children) {
165 this.segments = segments;
166 this.children = children;
167 /** The parent node in the url tree */
168 this.parent = null;
169 forEach(children, (v, k) => v.parent = this);
170 }
171 /** Whether the segment has child segments */
172 hasChildren() {
173 return this.numberOfChildren > 0;
174 }
175 /** Number of child segments */
176 get numberOfChildren() {
177 return Object.keys(this.children).length;
178 }
179 /** @docsNotRequired */
180 toString() {
181 return serializePaths(this);
182 }
183}
184/**
185 * @description
186 *
187 * Represents a single URL segment.
188 *
189 * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix
190 * parameters associated with the segment.
191 *
192 * @usageNotes
193 * ### Example
194 *
195 * ```
196 * @Component({templateUrl:'template.html'})
197 * class MyComponent {
198 * constructor(router: Router) {
199 * const tree: UrlTree = router.parseUrl('/team;id=33');
200 * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
201 * const s: UrlSegment[] = g.segments;
202 * s[0].path; // returns 'team'
203 * s[0].parameters; // returns {id: 33}
204 * }
205 * }
206 * ```
207 *
208 * @publicApi
209 */
210export class UrlSegment {
211 constructor(
212 /** The path part of a URL segment */
213 path,
214 /** The matrix parameters associated with a segment */
215 parameters) {
216 this.path = path;
217 this.parameters = parameters;
218 }
219 get parameterMap() {
220 if (!this._parameterMap) {
221 this._parameterMap = convertToParamMap(this.parameters);
222 }
223 return this._parameterMap;
224 }
225 /** @docsNotRequired */
226 toString() {
227 return serializePath(this);
228 }
229}
230export function equalSegments(as, bs) {
231 return equalPath(as, bs) && as.every((a, i) => shallowEqual(a.parameters, bs[i].parameters));
232}
233export function equalPath(as, bs) {
234 if (as.length !== bs.length)
235 return false;
236 return as.every((a, i) => a.path === bs[i].path);
237}
238export function mapChildrenIntoArray(segment, fn) {
239 let res = [];
240 forEach(segment.children, (child, childOutlet) => {
241 if (childOutlet === PRIMARY_OUTLET) {
242 res = res.concat(fn(child, childOutlet));
243 }
244 });
245 forEach(segment.children, (child, childOutlet) => {
246 if (childOutlet !== PRIMARY_OUTLET) {
247 res = res.concat(fn(child, childOutlet));
248 }
249 });
250 return res;
251}
252/**
253 * @description
254 *
255 * Serializes and deserializes a URL string into a URL tree.
256 *
257 * The url serialization strategy is customizable. You can
258 * make all URLs case insensitive by providing a custom UrlSerializer.
259 *
260 * See `DefaultUrlSerializer` for an example of a URL serializer.
261 *
262 * @publicApi
263 */
264export class UrlSerializer {
265}
266/**
267 * @description
268 *
269 * A default implementation of the `UrlSerializer`.
270 *
271 * Example URLs:
272 *
273 * ```
274 * /inbox/33(popup:compose)
275 * /inbox/33;open=true/messages/44
276 * ```
277 *
278 * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the
279 * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to
280 * specify route specific parameters.
281 *
282 * @publicApi
283 */
284export class DefaultUrlSerializer {
285 /** Parses a url into a `UrlTree` */
286 parse(url) {
287 const p = new UrlParser(url);
288 return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());
289 }
290 /** Converts a `UrlTree` into a url */
291 serialize(tree) {
292 const segment = `/${serializeSegment(tree.root, true)}`;
293 const query = serializeQueryParams(tree.queryParams);
294 const fragment = typeof tree.fragment === `string` ? `#${encodeUriFragment(tree.fragment)}` : '';
295 return `${segment}${query}${fragment}`;
296 }
297}
298const DEFAULT_SERIALIZER = new DefaultUrlSerializer();
299export function serializePaths(segment) {
300 return segment.segments.map(p => serializePath(p)).join('/');
301}
302function serializeSegment(segment, root) {
303 if (!segment.hasChildren()) {
304 return serializePaths(segment);
305 }
306 if (root) {
307 const primary = segment.children[PRIMARY_OUTLET] ?
308 serializeSegment(segment.children[PRIMARY_OUTLET], false) :
309 '';
310 const children = [];
311 forEach(segment.children, (v, k) => {
312 if (k !== PRIMARY_OUTLET) {
313 children.push(`${k}:${serializeSegment(v, false)}`);
314 }
315 });
316 return children.length > 0 ? `${primary}(${children.join('//')})` : primary;
317 }
318 else {
319 const children = mapChildrenIntoArray(segment, (v, k) => {
320 if (k === PRIMARY_OUTLET) {
321 return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];
322 }
323 return [`${k}:${serializeSegment(v, false)}`];
324 });
325 // use no parenthesis if the only child is a primary outlet route
326 if (Object.keys(segment.children).length === 1 && segment.children[PRIMARY_OUTLET] != null) {
327 return `${serializePaths(segment)}/${children[0]}`;
328 }
329 return `${serializePaths(segment)}/(${children.join('//')})`;
330 }
331}
332/**
333 * Encodes a URI string with the default encoding. This function will only ever be called from
334 * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need
335 * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't
336 * have to be encoded per https://url.spec.whatwg.org.
337 */
338function encodeUriString(s) {
339 return encodeURIComponent(s)
340 .replace(/%40/g, '@')
341 .replace(/%3A/gi, ':')
342 .replace(/%24/g, '$')
343 .replace(/%2C/gi, ',');
344}
345/**
346 * This function should be used to encode both keys and values in a query string key/value. In
347 * the following URL, you need to call encodeUriQuery on "k" and "v":
348 *
349 * http://www.site.org/html;mk=mv?k=v#f
350 */
351export function encodeUriQuery(s) {
352 return encodeUriString(s).replace(/%3B/gi, ';');
353}
354/**
355 * This function should be used to encode a URL fragment. In the following URL, you need to call
356 * encodeUriFragment on "f":
357 *
358 * http://www.site.org/html;mk=mv?k=v#f
359 */
360export function encodeUriFragment(s) {
361 return encodeURI(s);
362}
363/**
364 * This function should be run on any URI segment as well as the key and value in a key/value
365 * pair for matrix params. In the following URL, you need to call encodeUriSegment on "html",
366 * "mk", and "mv":
367 *
368 * http://www.site.org/html;mk=mv?k=v#f
369 */
370export function encodeUriSegment(s) {
371 return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&');
372}
373export function decode(s) {
374 return decodeURIComponent(s);
375}
376// Query keys/values should have the "+" replaced first, as "+" in a query string is " ".
377// decodeURIComponent function will not decode "+" as a space.
378export function decodeQuery(s) {
379 return decode(s.replace(/\+/g, '%20'));
380}
381export function serializePath(path) {
382 return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`;
383}
384function serializeMatrixParams(params) {
385 return Object.keys(params)
386 .map(key => `;${encodeUriSegment(key)}=${encodeUriSegment(params[key])}`)
387 .join('');
388}
389function serializeQueryParams(params) {
390 const strParams = Object.keys(params)
391 .map((name) => {
392 const value = params[name];
393 return Array.isArray(value) ?
394 value.map(v => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&') :
395 `${encodeUriQuery(name)}=${encodeUriQuery(value)}`;
396 })
397 .filter(s => !!s);
398 return strParams.length ? `?${strParams.join('&')}` : '';
399}
400const SEGMENT_RE = /^[^\/()?;=#]+/;
401function matchSegments(str) {
402 const match = str.match(SEGMENT_RE);
403 return match ? match[0] : '';
404}
405const QUERY_PARAM_RE = /^[^=?&#]+/;
406// Return the name of the query param at the start of the string or an empty string
407function matchQueryParams(str) {
408 const match = str.match(QUERY_PARAM_RE);
409 return match ? match[0] : '';
410}
411const QUERY_PARAM_VALUE_RE = /^[^?&#]+/;
412// Return the value of the query param at the start of the string or an empty string
413function matchUrlQueryParamValue(str) {
414 const match = str.match(QUERY_PARAM_VALUE_RE);
415 return match ? match[0] : '';
416}
417class UrlParser {
418 constructor(url) {
419 this.url = url;
420 this.remaining = url;
421 }
422 parseRootSegment() {
423 this.consumeOptional('/');
424 if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) {
425 return new UrlSegmentGroup([], {});
426 }
427 // The root segment group never has segments
428 return new UrlSegmentGroup([], this.parseChildren());
429 }
430 parseQueryParams() {
431 const params = {};
432 if (this.consumeOptional('?')) {
433 do {
434 this.parseQueryParam(params);
435 } while (this.consumeOptional('&'));
436 }
437 return params;
438 }
439 parseFragment() {
440 return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;
441 }
442 parseChildren() {
443 if (this.remaining === '') {
444 return {};
445 }
446 this.consumeOptional('/');
447 const segments = [];
448 if (!this.peekStartsWith('(')) {
449 segments.push(this.parseSegment());
450 }
451 while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {
452 this.capture('/');
453 segments.push(this.parseSegment());
454 }
455 let children = {};
456 if (this.peekStartsWith('/(')) {
457 this.capture('/');
458 children = this.parseParens(true);
459 }
460 let res = {};
461 if (this.peekStartsWith('(')) {
462 res = this.parseParens(false);
463 }
464 if (segments.length > 0 || Object.keys(children).length > 0) {
465 res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);
466 }
467 return res;
468 }
469 // parse a segment with its matrix parameters
470 // ie `name;k1=v1;k2`
471 parseSegment() {
472 const path = matchSegments(this.remaining);
473 if (path === '' && this.peekStartsWith(';')) {
474 throw new Error(`Empty path url segment cannot have parameters: '${this.remaining}'.`);
475 }
476 this.capture(path);
477 return new UrlSegment(decode(path), this.parseMatrixParams());
478 }
479 parseMatrixParams() {
480 const params = {};
481 while (this.consumeOptional(';')) {
482 this.parseParam(params);
483 }
484 return params;
485 }
486 parseParam(params) {
487 const key = matchSegments(this.remaining);
488 if (!key) {
489 return;
490 }
491 this.capture(key);
492 let value = '';
493 if (this.consumeOptional('=')) {
494 const valueMatch = matchSegments(this.remaining);
495 if (valueMatch) {
496 value = valueMatch;
497 this.capture(value);
498 }
499 }
500 params[decode(key)] = decode(value);
501 }
502 // Parse a single query parameter `name[=value]`
503 parseQueryParam(params) {
504 const key = matchQueryParams(this.remaining);
505 if (!key) {
506 return;
507 }
508 this.capture(key);
509 let value = '';
510 if (this.consumeOptional('=')) {
511 const valueMatch = matchUrlQueryParamValue(this.remaining);
512 if (valueMatch) {
513 value = valueMatch;
514 this.capture(value);
515 }
516 }
517 const decodedKey = decodeQuery(key);
518 const decodedVal = decodeQuery(value);
519 if (params.hasOwnProperty(decodedKey)) {
520 // Append to existing values
521 let currentVal = params[decodedKey];
522 if (!Array.isArray(currentVal)) {
523 currentVal = [currentVal];
524 params[decodedKey] = currentVal;
525 }
526 currentVal.push(decodedVal);
527 }
528 else {
529 // Create a new value
530 params[decodedKey] = decodedVal;
531 }
532 }
533 // parse `(a/b//outlet_name:c/d)`
534 parseParens(allowPrimary) {
535 const segments = {};
536 this.capture('(');
537 while (!this.consumeOptional(')') && this.remaining.length > 0) {
538 const path = matchSegments(this.remaining);
539 const next = this.remaining[path.length];
540 // if is is not one of these characters, then the segment was unescaped
541 // or the group was not closed
542 if (next !== '/' && next !== ')' && next !== ';') {
543 throw new Error(`Cannot parse url '${this.url}'`);
544 }
545 let outletName = undefined;
546 if (path.indexOf(':') > -1) {
547 outletName = path.substr(0, path.indexOf(':'));
548 this.capture(outletName);
549 this.capture(':');
550 }
551 else if (allowPrimary) {
552 outletName = PRIMARY_OUTLET;
553 }
554 const children = this.parseChildren();
555 segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] :
556 new UrlSegmentGroup([], children);
557 this.consumeOptional('//');
558 }
559 return segments;
560 }
561 peekStartsWith(str) {
562 return this.remaining.startsWith(str);
563 }
564 // Consumes the prefix when it is present and returns whether it has been consumed
565 consumeOptional(str) {
566 if (this.peekStartsWith(str)) {
567 this.remaining = this.remaining.substring(str.length);
568 return true;
569 }
570 return false;
571 }
572 capture(str) {
573 if (!this.consumeOptional(str)) {
574 throw new Error(`Expected "${str}".`);
575 }
576 }
577}
578//# sourceMappingURL=data:application/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XMucmVtYWluaW5nID0gdGhpcy5yZW1haW5pbmcuc3Vic3RyaW5nKHN0ci5sZW5ndGgpO1xuICAgICAgcmV0dXJuIHRydWU7XG4gICAgfVxuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIHByaXZhdGUgY2FwdHVyZShzdHI6IHN0cmluZyk6IHZvaWQge1xuICAgIGlmICghdGhpcy5jb25zdW1lT3B0aW9uYWwoc3RyKSkge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKGBFeHBlY3RlZCBcIiR7c3RyfVwiLmApO1xuICAgIH1cbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.