source: trip-planner-front/node_modules/@angular/cdk/bundles/cdk-coercion.umd.js@ 6a80231

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

initial commit

  • Property mode set to 100644
File size: 20.0 KB
RevLine 
[6a3a178]1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
3 typeof define === 'function' && define.amd ? define('@angular/cdk/coercion', ['exports', '@angular/core'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.coercion = {}), global.ng.core));
5}(this, (function (exports, core) { 'use strict';
6
7 /**
8 * @license
9 * Copyright Google LLC All Rights Reserved.
10 *
11 * Use of this source code is governed by an MIT-style license that can be
12 * found in the LICENSE file at https://angular.io/license
13 */
14 /** Coerces a data-bound value (typically a string) to a boolean. */
15 function coerceBooleanProperty(value) {
16 return value != null && "" + value !== 'false';
17 }
18
19 /**
20 * @license
21 * Copyright Google LLC All Rights Reserved.
22 *
23 * Use of this source code is governed by an MIT-style license that can be
24 * found in the LICENSE file at https://angular.io/license
25 */
26 function coerceNumberProperty(value, fallbackValue) {
27 if (fallbackValue === void 0) { fallbackValue = 0; }
28 return _isNumberValue(value) ? Number(value) : fallbackValue;
29 }
30 /**
31 * Whether the provided value is considered a number.
32 * @docs-private
33 */
34 function _isNumberValue(value) {
35 // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,
36 // and other non-number values as NaN, where Number just uses 0) but it considers the string
37 // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.
38 return !isNaN(parseFloat(value)) && !isNaN(Number(value));
39 }
40
41 /**
42 * @license
43 * Copyright Google LLC All Rights Reserved.
44 *
45 * Use of this source code is governed by an MIT-style license that can be
46 * found in the LICENSE file at https://angular.io/license
47 */
48 function coerceArray(value) {
49 return Array.isArray(value) ? value : [value];
50 }
51
52 /**
53 * @license
54 * Copyright Google LLC All Rights Reserved.
55 *
56 * Use of this source code is governed by an MIT-style license that can be
57 * found in the LICENSE file at https://angular.io/license
58 */
59 /** Coerces a value to a CSS pixel value. */
60 function coerceCssPixelValue(value) {
61 if (value == null) {
62 return '';
63 }
64 return typeof value === 'string' ? value : value + "px";
65 }
66
67 /**
68 * @license
69 * Copyright Google LLC All Rights Reserved.
70 *
71 * Use of this source code is governed by an MIT-style license that can be
72 * found in the LICENSE file at https://angular.io/license
73 */
74 /**
75 * Coerces an ElementRef or an Element into an element.
76 * Useful for APIs that can accept either a ref or the native element itself.
77 */
78 function coerceElement(elementOrRef) {
79 return elementOrRef instanceof core.ElementRef ? elementOrRef.nativeElement : elementOrRef;
80 }
81
82 /*! *****************************************************************************
83 Copyright (c) Microsoft Corporation.
84
85 Permission to use, copy, modify, and/or distribute this software for any
86 purpose with or without fee is hereby granted.
87
88 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
89 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
90 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
91 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
92 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
93 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
94 PERFORMANCE OF THIS SOFTWARE.
95 ***************************************************************************** */
96 /* global Reflect, Promise */
97 var extendStatics = function (d, b) {
98 extendStatics = Object.setPrototypeOf ||
99 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
100 function (d, b) { for (var p in b)
101 if (Object.prototype.hasOwnProperty.call(b, p))
102 d[p] = b[p]; };
103 return extendStatics(d, b);
104 };
105 function __extends(d, b) {
106 if (typeof b !== "function" && b !== null)
107 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
108 extendStatics(d, b);
109 function __() { this.constructor = d; }
110 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
111 }
112 var __assign = function () {
113 __assign = Object.assign || function __assign(t) {
114 for (var s, i = 1, n = arguments.length; i < n; i++) {
115 s = arguments[i];
116 for (var p in s)
117 if (Object.prototype.hasOwnProperty.call(s, p))
118 t[p] = s[p];
119 }
120 return t;
121 };
122 return __assign.apply(this, arguments);
123 };
124 function __rest(s, e) {
125 var t = {};
126 for (var p in s)
127 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
128 t[p] = s[p];
129 if (s != null && typeof Object.getOwnPropertySymbols === "function")
130 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
131 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
132 t[p[i]] = s[p[i]];
133 }
134 return t;
135 }
136 function __decorate(decorators, target, key, desc) {
137 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
138 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
139 r = Reflect.decorate(decorators, target, key, desc);
140 else
141 for (var i = decorators.length - 1; i >= 0; i--)
142 if (d = decorators[i])
143 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
144 return c > 3 && r && Object.defineProperty(target, key, r), r;
145 }
146 function __param(paramIndex, decorator) {
147 return function (target, key) { decorator(target, key, paramIndex); };
148 }
149 function __metadata(metadataKey, metadataValue) {
150 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
151 return Reflect.metadata(metadataKey, metadataValue);
152 }
153 function __awaiter(thisArg, _arguments, P, generator) {
154 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
155 return new (P || (P = Promise))(function (resolve, reject) {
156 function fulfilled(value) { try {
157 step(generator.next(value));
158 }
159 catch (e) {
160 reject(e);
161 } }
162 function rejected(value) { try {
163 step(generator["throw"](value));
164 }
165 catch (e) {
166 reject(e);
167 } }
168 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
169 step((generator = generator.apply(thisArg, _arguments || [])).next());
170 });
171 }
172 function __generator(thisArg, body) {
173 var _ = { label: 0, sent: function () { if (t[0] & 1)
174 throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
175 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
176 function verb(n) { return function (v) { return step([n, v]); }; }
177 function step(op) {
178 if (f)
179 throw new TypeError("Generator is already executing.");
180 while (_)
181 try {
182 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
183 return t;
184 if (y = 0, t)
185 op = [op[0] & 2, t.value];
186 switch (op[0]) {
187 case 0:
188 case 1:
189 t = op;
190 break;
191 case 4:
192 _.label++;
193 return { value: op[1], done: false };
194 case 5:
195 _.label++;
196 y = op[1];
197 op = [0];
198 continue;
199 case 7:
200 op = _.ops.pop();
201 _.trys.pop();
202 continue;
203 default:
204 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
205 _ = 0;
206 continue;
207 }
208 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
209 _.label = op[1];
210 break;
211 }
212 if (op[0] === 6 && _.label < t[1]) {
213 _.label = t[1];
214 t = op;
215 break;
216 }
217 if (t && _.label < t[2]) {
218 _.label = t[2];
219 _.ops.push(op);
220 break;
221 }
222 if (t[2])
223 _.ops.pop();
224 _.trys.pop();
225 continue;
226 }
227 op = body.call(thisArg, _);
228 }
229 catch (e) {
230 op = [6, e];
231 y = 0;
232 }
233 finally {
234 f = t = 0;
235 }
236 if (op[0] & 5)
237 throw op[1];
238 return { value: op[0] ? op[1] : void 0, done: true };
239 }
240 }
241 var __createBinding = Object.create ? (function (o, m, k, k2) {
242 if (k2 === undefined)
243 k2 = k;
244 Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
245 }) : (function (o, m, k, k2) {
246 if (k2 === undefined)
247 k2 = k;
248 o[k2] = m[k];
249 });
250 function __exportStar(m, o) {
251 for (var p in m)
252 if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
253 __createBinding(o, m, p);
254 }
255 function __values(o) {
256 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
257 if (m)
258 return m.call(o);
259 if (o && typeof o.length === "number")
260 return {
261 next: function () {
262 if (o && i >= o.length)
263 o = void 0;
264 return { value: o && o[i++], done: !o };
265 }
266 };
267 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
268 }
269 function __read(o, n) {
270 var m = typeof Symbol === "function" && o[Symbol.iterator];
271 if (!m)
272 return o;
273 var i = m.call(o), r, ar = [], e;
274 try {
275 while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
276 ar.push(r.value);
277 }
278 catch (error) {
279 e = { error: error };
280 }
281 finally {
282 try {
283 if (r && !r.done && (m = i["return"]))
284 m.call(i);
285 }
286 finally {
287 if (e)
288 throw e.error;
289 }
290 }
291 return ar;
292 }
293 /** @deprecated */
294 function __spread() {
295 for (var ar = [], i = 0; i < arguments.length; i++)
296 ar = ar.concat(__read(arguments[i]));
297 return ar;
298 }
299 /** @deprecated */
300 function __spreadArrays() {
301 for (var s = 0, i = 0, il = arguments.length; i < il; i++)
302 s += arguments[i].length;
303 for (var r = Array(s), k = 0, i = 0; i < il; i++)
304 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
305 r[k] = a[j];
306 return r;
307 }
308 function __spreadArray(to, from, pack) {
309 if (pack || arguments.length === 2)
310 for (var i = 0, l = from.length, ar; i < l; i++) {
311 if (ar || !(i in from)) {
312 if (!ar)
313 ar = Array.prototype.slice.call(from, 0, i);
314 ar[i] = from[i];
315 }
316 }
317 return to.concat(ar || from);
318 }
319 function __await(v) {
320 return this instanceof __await ? (this.v = v, this) : new __await(v);
321 }
322 function __asyncGenerator(thisArg, _arguments, generator) {
323 if (!Symbol.asyncIterator)
324 throw new TypeError("Symbol.asyncIterator is not defined.");
325 var g = generator.apply(thisArg, _arguments || []), i, q = [];
326 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
327 function verb(n) { if (g[n])
328 i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
329 function resume(n, v) { try {
330 step(g[n](v));
331 }
332 catch (e) {
333 settle(q[0][3], e);
334 } }
335 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
336 function fulfill(value) { resume("next", value); }
337 function reject(value) { resume("throw", value); }
338 function settle(f, v) { if (f(v), q.shift(), q.length)
339 resume(q[0][0], q[0][1]); }
340 }
341 function __asyncDelegator(o) {
342 var i, p;
343 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
344 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
345 }
346 function __asyncValues(o) {
347 if (!Symbol.asyncIterator)
348 throw new TypeError("Symbol.asyncIterator is not defined.");
349 var m = o[Symbol.asyncIterator], i;
350 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
351 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
352 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
353 }
354 function __makeTemplateObject(cooked, raw) {
355 if (Object.defineProperty) {
356 Object.defineProperty(cooked, "raw", { value: raw });
357 }
358 else {
359 cooked.raw = raw;
360 }
361 return cooked;
362 }
363 ;
364 var __setModuleDefault = Object.create ? (function (o, v) {
365 Object.defineProperty(o, "default", { enumerable: true, value: v });
366 }) : function (o, v) {
367 o["default"] = v;
368 };
369 function __importStar(mod) {
370 if (mod && mod.__esModule)
371 return mod;
372 var result = {};
373 if (mod != null)
374 for (var k in mod)
375 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
376 __createBinding(result, mod, k);
377 __setModuleDefault(result, mod);
378 return result;
379 }
380 function __importDefault(mod) {
381 return (mod && mod.__esModule) ? mod : { default: mod };
382 }
383 function __classPrivateFieldGet(receiver, state, kind, f) {
384 if (kind === "a" && !f)
385 throw new TypeError("Private accessor was defined without a getter");
386 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
387 throw new TypeError("Cannot read private member from an object whose class did not declare it");
388 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
389 }
390 function __classPrivateFieldSet(receiver, state, value, kind, f) {
391 if (kind === "m")
392 throw new TypeError("Private method is not writable");
393 if (kind === "a" && !f)
394 throw new TypeError("Private accessor was defined without a setter");
395 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
396 throw new TypeError("Cannot write private member to an object whose class did not declare it");
397 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
398 }
399
400 /**
401 * @license
402 * Copyright Google LLC All Rights Reserved.
403 *
404 * Use of this source code is governed by an MIT-style license that can be
405 * found in the LICENSE file at https://angular.io/license
406 */
407 /**
408 * Coerces a value to an array of trimmed non-empty strings.
409 * Any input that is not an array, `null` or `undefined` will be turned into a string
410 * via `toString()` and subsequently split with the given separator.
411 * `null` and `undefined` will result in an empty array.
412 * This results in the following outcomes:
413 * - `null` -&gt; `[]`
414 * - `[null]` -&gt; `["null"]`
415 * - `["a", "b ", " "]` -&gt; `["a", "b"]`
416 * - `[1, [2, 3]]` -&gt; `["1", "2,3"]`
417 * - `[{ a: 0 }]` -&gt; `["[object Object]"]`
418 * - `{ a: 0 }` -&gt; `["[object", "Object]"]`
419 *
420 * Useful for defining CSS classes or table columns.
421 * @param value the value to coerce into an array of strings
422 * @param separator split-separator if value isn't an array
423 */
424 function coerceStringArray(value, separator) {
425 var e_1, _a;
426 if (separator === void 0) { separator = /\s+/; }
427 var result = [];
428 if (value != null) {
429 var sourceValues = Array.isArray(value) ? value : ("" + value).split(separator);
430 try {
431 for (var sourceValues_1 = __values(sourceValues), sourceValues_1_1 = sourceValues_1.next(); !sourceValues_1_1.done; sourceValues_1_1 = sourceValues_1.next()) {
432 var sourceValue = sourceValues_1_1.value;
433 var trimmedString = ("" + sourceValue).trim();
434 if (trimmedString) {
435 result.push(trimmedString);
436 }
437 }
438 }
439 catch (e_1_1) { e_1 = { error: e_1_1 }; }
440 finally {
441 try {
442 if (sourceValues_1_1 && !sourceValues_1_1.done && (_a = sourceValues_1.return)) _a.call(sourceValues_1);
443 }
444 finally { if (e_1) throw e_1.error; }
445 }
446 }
447 return result;
448 }
449
450 /**
451 * @license
452 * Copyright Google LLC All Rights Reserved.
453 *
454 * Use of this source code is governed by an MIT-style license that can be
455 * found in the LICENSE file at https://angular.io/license
456 */
457
458 /**
459 * @license
460 * Copyright Google LLC All Rights Reserved.
461 *
462 * Use of this source code is governed by an MIT-style license that can be
463 * found in the LICENSE file at https://angular.io/license
464 */
465
466 exports._isNumberValue = _isNumberValue;
467 exports.coerceArray = coerceArray;
468 exports.coerceBooleanProperty = coerceBooleanProperty;
469 exports.coerceCssPixelValue = coerceCssPixelValue;
470 exports.coerceElement = coerceElement;
471 exports.coerceNumberProperty = coerceNumberProperty;
472 exports.coerceStringArray = coerceStringArray;
473
474 Object.defineProperty(exports, '__esModule', { value: true });
475
476})));
477//# sourceMappingURL=cdk-coercion.umd.js.map
Note: See TracBrowser for help on using the repository browser.