PageSourceSearch

https://portafolio-personal-264fb.firebaseapp.com/polyfills-es2015.js

js portafolio-personal-264fb.firebaseapp.com collected 2026-10-03 08:13:35 UTC 153,448 bytes, 3,265 lines download raw bytes

1(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["polyfills"],{
2
3/***/ 2:
4/*!********************************!*\
5  !*** multi ./src/polyfills.ts ***!
6  \********************************/
7/*! no static exports found */
8/***/ (function(module, exports, __webpack_require__) {
9
10module.exports = __webpack_require__(/*! /home/reffcp/Documentos/proyectos/personales/portafolio-personal/src/polyfills.ts */"hN/g");
11
12
13/***/ }),
14
15/***/ "N/DB":
16/*!*********************************************************!*\
17  !*** ./node_modules/@angular/localize/fesm2015/init.js ***!
18  \*********************************************************/
19/*! exports provided: $localize */
20/***/ (function(module, __webpack_exports__, __webpack_require__) {
21
22"use strict";
23__webpack_require__.r(__webpack_exports__);
24/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$localize", function() { return $localize; });
25/**
26 * @license Angular v11.2.14
27 * (c) 2010-2021 Google LLC. https://angular.io/
28 * License: MIT
29 */
30
31/**
32 * @license
33 * Copyright Google LLC All Rights Reserved.
34 *
35 * Use of this source code is governed by an MIT-style license that can be
36 * found in the LICENSE file at https://angular.io/license
37 */
38const __globalThis = typeof globalThis !== 'undefined' && globalThis;
39const __window = typeof window !== 'undefined' && window;
40const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
41    self instanceof WorkerGlobalScope && self;
42const __global = typeof global !== 'undefined' && global;
43// Always use __globalThis if available; this is the spec-defined global variable across all
44// environments.
45// Then fallback to __global first; in Node tests both __global and __window may be defined.
46const _global = __globalThis || __global || __window || __self;
47
48/**
49 * @license
50 * Copyright Google LLC All Rights Reserved.
51 *
52 * Use of this source code is governed by an MIT-style license that can be
53 * found in the LICENSE file at https://angular.io/license
54 */
55/**
56 * Tag a template literal string for localization.
57 *
58 * For example:
59 *
60 * ```ts
61 * $localize `some string to localize`
62 * ```
63 *
64 * **Providing meaning, description and id**
65 *
66 * You can optionally specify one or more of `meaning`, `description` and `id` for a localized
67 * string by pre-pending it with a colon delimited block of the form:
68 *
69 * ```ts
70 * $localize`:meaning|description@@id:source message text`;
71 *
72 * $localize`:meaning|:source message text`;
73 * $localize`:description:source message text`;
74 * $localize`:@@id:source message text`;
75 * ```
76 *
77 * This format is the same as that used for `i18n` markers in Angular templates. See the
78 * [Angular 18n guide](guide/i18n#mark-text-for-translations).
79 *
80 * **Naming placeholders**
81 *
82 * If the template literal string contains expressions, then the expressions will be automatically
83 * associated with placeholder names for you.
84 *
85 * For example:
86 *
87 * ```ts
88 * $localize `Hi ${name}! There are ${items.length} items.`;
89 * ```
90 *
91 * will generate a message-source of `Hi {$PH}! There are {$PH_1} items`.
92 *
93 * The recommended practice is to name the placeholder associated with each expression though.
94 *
95 * Do this by providing the placeholder name wrapped in `:` characters directly after the
96 * expression. These placeholder names are stripped out of the rendered localized string.
97 *
98 * For example, to name the `items.length` expression placeholder `itemCount` you write:
99 *
100 * ```ts
101 * $localize `There are ${items.length}:itemCount: items`;
102 * ```
103 *
104 * **Escaping colon markers**
105 *
106 * If you need to use a `:` character directly at the start of a tagged string that has no
107 * metadata block, or directly after a substitution expression that has no name you must escape
108 * the `:` by preceding it with a backslash:
109 *
110 * For example:
111 *
112 * ```ts
113 * // message has a metadata block so no need to escape colon
114 * $localize `:some description::this message starts with a colon (:)`;
115 * // no metadata block so the colon must be escaped
116 * $localize `\:this message starts with a colon (:)`;
117 * ```
118 *
119 * ```ts
120 * // named substitution so no need to escape colon
121 * $localize `${label}:label:: ${}`
122 * // anonymous substitution so colon must be escaped
123 * $localize `${label}\: ${}`
124 * ```
125 *
126 * **Processing localized strings:**
127 *
128 * There are three scenarios:
129 *
130 * * **compile-time inlining**: the `$localize` tag is transformed at compile time by a
131 * transpiler, removing the tag and replacing the template literal string with a translated
132 * literal string from a collection of translations provided to the transpilation tool.
133 *
134 * * **run-time evaluation**: the `$localize` tag is a run-time function that replaces and
135 * reorders the parts (static strings and expressions) of the template literal string with strings
136 * from a collection of translations loaded at run-time.
137 *
138 * * **pass-through evaluation**: the `$localize` tag is a run-time function that simply evaluates
139 * the original template literal string without applying any translations to the parts. This
140 * version is used during development or where there is no need to translate the localized
141 * template literals.
142 *
143 * @param messageParts a collection of the static parts of the template string.
144 * @param expressions a collection of the values of each placeholder in the template string.
145 * @returns the translated string, with the `messageParts` and `expressions` interleaved together.
146 *
147 * @globalApi
148 * @publicApi
149 */
150const $localize = function (messageParts, ...expressions) {
151    if ($localize.translate) {
152        // Don't use array expansion here to avoid the compiler adding `__read()` helper unnecessarily.
153        const translation = $localize.translate(messageParts, expressions);
154        messageParts = translation[0];
155        expressions = translation[1];
156    }
157    let message = stripBlock(messageParts[0], messageParts.raw[0]);
158    for (let i = 1; i < messageParts.length; i++) {
159        message += expressions[i - 1] + stripBlock(messageParts[i], messageParts.raw[i]);
160    }
161    return message;
162};
163const BLOCK_MARKER = ':';
164/**
165 * Strip a delimited "block" from the start of the `messagePart`, if it is found.
166 *
167 * If a marker character (:) actually appears in the content at the start of a tagged string or
168 * after a substitution expression, where a block has not been provided the character must be
169 * escaped with a backslash, `\:`. This function checks for this by looking at the `raw`
170 * messagePart, which should still contain the backslash.
171 *
172 * @param messagePart The cooked message part to process.
173 * @param rawMessagePart The raw message part to check.
174 * @returns the message part with the placeholder name stripped, if found.
175 * @throws an error if the block is unterminated
176 */
177function stripBlock(messagePart, rawMessagePart) {
178    return rawMessagePart.charAt(0) === BLOCK_MARKER ?
179        messagePart.substring(findEndOfBlock(messagePart, rawMessagePart) + 1) :
180        messagePart;
181}
182/**
183 * Find the end of a "marked block" indicated by the first non-e
183scaped colon.
184 *
185 * @param cooked The cooked string (where escaped chars have been processed)
186 * @param raw The raw string (where escape sequences are still in place)
187 *
188 * @returns the index of the end of block marker
189 * @throws an error if the block is unterminated
190 */
191function findEndOfBlock(cooked, raw) {
192    /***********************************************************************************************
193     * This function is repeated in `src/utils/messages.ts` and the two should be kept in sync.
194     * The reason is that this file is marked as having side-effects, and if we import `messages.ts`
195     * into it, the whole of `src/utils` will be included in this bundle and none of the functions
196     * will be tree shaken.
197     ***********************************************************************************************/
198    for (let cookedIndex = 1, rawIndex = 1; cookedIndex < cooked.length; cookedIndex++, rawIndex++) {
199        if (raw[rawIndex] === '\\') {
200            rawIndex++;
201        }
202        else if (cooked[cookedIndex] === BLOCK_MARKER) {
203            return cookedIndex;
204        }
205    }
206    throw new Error(`Unterminated $localize metadata block in "${raw}".`);
207}
208
209/**
210 * @license
211 * Copyright Google LLC All Rights Reserved.
212 *
213 * Use of this source code is governed by an MIT-style license that can be
214 * found in the LICENSE file at https://angular.io/license
215 */
216
217/**
218 * @license
219 * Copyright Google LLC All Rights Reserved.
220 *
221 * Use of this source code is governed by an MIT-style license that can be
222 * found in the LICENSE file at https://angular.io/license
223 */
224// Attach $localize to the global context, as a side-effect of this module.
225_global.$localize = $localize;
226
227
228//# sourceMappingURL=init.js.map
229
230
231/***/ }),
232
233/***/ "hN/g":
234/*!**************************!*\
235  !*** ./src/polyfills.ts ***!
236  \**************************/
237/*! no exports provided */
238/***/ (function(module, __webpack_exports__, __webpack_require__) {
239
240"use strict";
241__webpack_require__.r(__webpack_exports__);
242/* harmony import */ var _angular_localize_init__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/localize/init */ "N/DB");
243/* harmony import */ var zone_js_dist_zone__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zone.js/dist/zone */ "pDpN");
244/* harmony import */ var zone_js_dist_zone__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(zone_js_dist_zone__WEBPACK_IMPORTED_MODULE_1__);
245/***************************************************************************************************
246 * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
247 */
248
249/**
250 * This file includes polyfills needed by Angular and is loaded before the app.
251 * You can add your own extra polyfills to this file.
252 *
253 * This file is divided into 2 sections:
254 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
255 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
256 *      file.
257 *
258 * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
259 * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
260 * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
261 *
262 * Learn more in https://angular.io/guide/browser-support
263 */
264/***************************************************************************************************
265 * BROWSER POLYFILLS
266 */
267/** IE10 and IE11 requires the following for NgClass support on SVG elements */
268// import 'classlist.js';  // Run `npm install --save classlist.js`.
269/**
270 * Web Animations `@angular/platform-browser/animations`
271 * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
272 * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
273 */
274// import 'web-animations-js';  // Run `npm install --save web-animations-js`.
275/**
276 * By default, zone.js will patch all possible macroTask and DomEvents
277 * user can disable parts of macroTask/DomEvents patch by setting following flags
278 * because those flags need to be set before `zone.js` being loaded, and webpack
279 * will put import in the top of bundle, so user need to create a separate file
280 * in this directory (for example: zone-flags.ts), and put the following flags
281 * into that file, and then add the following code before importing zone.js.
282 * import './zone-flags';
283 *
284 * The flags allowed in zone-flags.ts are listed here.
285 *
286 * The following flags will work for all browsers.
287 *
288 * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
289 * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
290 * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
291 *
292 *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
293 *  with the following flag, it will bypass `zone.js` patch for IE/Edge
294 *
295 *  (window as any).__Zone_enable_cross_context_check = true;
296 *
297 */
298/***************************************************************************************************
299 * Zone JS is required by default for Angular itself.
300 */
301 // Included with Angular CLI.
302/***************************************************************************************************
303 * APPLICATION IMPORTS
304 */
305
306
307/***/ }),
308
309/***/ "pDpN":
310/*!*****************************************************!*\
311  !*** ./node_modules/zone.js/dist/zone-evergreen.js ***!
312  \*****************************************************/
313/*! no static exports found */
314/***/ (function(module, exports, __webpack_require__) {
315
316var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
317* @license Angular v9.1.0-next.4+61.sha-e552591.with-local-changes
318* (c) 2010-2020 Google LLC. https://angular.io/
319* License: MIT
320*/
321(function (factory) {
322     true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
323				__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
324				(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
325				__WEBPACK_AMD_DEFINE_FACTORY__),
326				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) :
327    undefined;
328}((function () { 'use strict';
329
330    /**
331     * @license
332     * Copyright Google Inc. All Rights Reserved.
333     *
334     * Use of this source code is governed by an MIT-style license that can be
335     * found in the LICENSE file at https://angular.io/license
336     */
337    const Zone$1 = (function (global) {
338        const performance = global['performance'];
339        function mark(name) { performance && performance['mark'] && performance['mark'](name); }
340        function performanceMeasure(name, label) {
341            performance && performance['measure'] && performance['measure'](name, label);
342        }
343        mark('Zone');
344        // Initialize before it's accessed below.
345        // __Zone_symbol_prefix global can be used to override the default zone
346        // symbol prefix with a custom one if needed.
347        const symbolPrefix = global['__Zone_symbol_prefix'] || '__zone_symbol__';
348        function __symbol__(name) { return symbolPrefix + name; }
349        const checkDuplicate = global[__symbol__('forceDuplicateZoneCheck')] === true;
350        if (global['Zone']) {
351            // if global['Zone'] already exists (maybe zone.js was already loaded or
352            // some other lib also registered a global object named Zone), we may need
353            // to throw an error, but sometimes user may not want this error.
354            // For example,
355            // we have two web pages, page1 includes zone.js, page2 doesn't.
356            // and the 1st time user load page1 and page2, everything work fine,
357            // but when user load page2 again, error occurs because global['Zone'] already exists.
358            // so we add a flag to let user choose whether to throw this error or not.
359            // By default, if existing Zone is from zone.js, we will not throw the error.
360            if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') {
361                throw new Error('Zone already loaded.');
362            }
363            else {
364                return global['Zone'];
365            }
366        }
367        class Zone {
368            constructor(parent, zoneSpec) {
369                this._parent = parent;
370                this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
371                this._properties = zoneSpec && zoneSpec.properties || {};
372                this._zoneDelegate =
373                    new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);
374            }
375            static assertZonePatched() {
376                if (global['Promise'] !== patches['ZoneAwarePromise']) {
377                    throw new Error('Zone.js has detected that ZoneAwarePromise `(window|global).Promise` ' +
378                        'has been overwritten.\n' +
379                        'Most likely cause is that a Promise polyfill has been loaded ' +
380                        'after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. ' +
381                        'If you must load one, do so before loading zone.js.)');
382                }
383            }
384            static get root() {
385                let zone = Zone.current;
386                while (zone.parent) {
387                    zone = zone.parent;
388                }
389                return zone;
390            }
391            static get current() { return _currentZoneFrame.zone; }
392            static get currentTask() { return _currentTask; }
393            // tslint:disable-next-line:require-internal-with-underscore
394            static __load_patch(name, fn) {
395                if (patches.hasOwnProperty(name)) {
396                    if (checkDuplicate) {
397                        throw Error('Already loaded patch: ' + n
vendor: 24,693 bytes, lines 397-898
397ame);
398                    }
399                }
400                else if (!global['__Zone_disable_' + name]) {
401                    const perfName = 'Zone:' + name;
402                    mark(perfName);
403                    patches[name] = fn(global, Zone, _api);
404                    performanceMeasure(perfName, perfName);
405                }
406            }
407            get parent() { return this._parent; }
408            get name() { return this._name; }
409            get(key) {
410                const zone = this.getZoneWith(key);
411                if (zone)
412                    return zone._properties[key];
413            }
414            getZoneWith(key) {
415                let current = this;
416                while (current) {
417                    if (current._properties.hasOwnProperty(key)) {
418                        return current;
419                    }
420                    current = current._parent;
421                }
422                return null;
423            }
424            fork(zoneSpec) {
425                if (!zoneSpec)
426                    throw new Error('ZoneSpec required!');
427                return this._zoneDelegate.fork(this, zoneSpec);
428            }
429            wrap(callback, source) {
430                if (typeof callback !== 'function') {
431                    throw new Error('Expecting function got: ' + callback);
432                }
433                const _callback = this._zoneDelegate.intercept(this, callback, source);
434                const zone = this;
435                return function () {
436                    return zone.runGuarded(_callback, this, arguments, source);
437                };
438            }
439            run(callback, applyThis, applyArgs, source) {
440                _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
441                try {
442                    return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
443                }
444                finally {
445                    _currentZoneFrame = _currentZoneFrame.parent;
446                }
447            }
448            runGuarded(callback, applyThis = null, applyArgs, source) {
449                _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
450                try {
451                    try {
452                        return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
453                    }
454                    catch (error) {
455                        if (this._zoneDelegate.handleError(this, error)) {
456                            throw error;
457                        }
458                    }
459                }
460                finally {
461                    _currentZoneFrame = _currentZoneFrame.parent;
462                }
463            }
464            runTask(task, applyThis, applyArgs) {
465                if (task.zone != this) {
466                    throw new Error('A task can only be run in the zone of creation! (Creation: ' +
467                        (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');
468                }
469                // https://github.com/angular/zone.js/issues/778, sometimes eventTask
470                // will run in notScheduled(canceled) state, we should not try to
471                // run such kind of task but just return
472                if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {
473                    return;
474                }
475                const reEntryGuard = task.state != running;
476                reEntryGuard && task._transitionTo(running, scheduled);
477                task.runCount++;
478                const previousTask = _currentTask;
479                _currentTask = task;
480                _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
481                try {
482                    if (task.type == macroTask && task.data && !task.data.isPeriodic) {
483                        task.cancelFn = undefined;
484                    }
485                    try {
486                        return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
487                    }
488                    catch (error) {
489                        if (this._zoneDelegate.handleError(this, error)) {
490                            throw error;
491                        }
492                    }
493                }
494                finally {
495                    // if the task's state is notScheduled or unknown, then it has already been cancelled
496                    // we should not reset the state to scheduled
497                    if (task.state !== notScheduled && task.state !== unknown) {
498                        if (task.type == eventTask || (task.data && task.data.isPeriodic)) {
499                            reEntryGuard && task._transitionTo(scheduled, running);
500                        }
501                        else {
502                            task.runCount = 0;
503                            this._updateTaskCount(task, -1);
504                            reEntryGuard &&
505                                task._transitionTo(notScheduled, running, notScheduled);
506                        }
507                    }
508                    _currentZoneFrame = _currentZoneFrame.parent;
509                    _currentTask = previousTask;
510                }
511            }
512            scheduleTask(task) {
513                if (task.zone && task.zone !== this) {
514                    // check if the task was rescheduled, the newZone
515                    // should not be the children of the original zone
516                    let newZone = this;
517                    while (newZone) {
518                        if (newZone === task.zone) {
519                            throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${task.zone.name}`);
520                        }
521                        newZone = newZone.parent;
522                    }
523                }
524                task._transitionTo(scheduling, notScheduled);
525                const zoneDelegates = [];
526                task._zoneDelegates = zoneDelegates;
527                task._zone = this;
528                try {
529                    task = this._zoneDelegate.scheduleTask(this, task);
530                }
531                catch (err) {
532                    // should set task's state to unknown when scheduleTask throw error
533                    // because the err may from reschedule, so the fromState maybe notScheduled
534                    task._transitionTo(unknown, scheduling, notScheduled);
535                    // TODO: @JiaLiPassion, should we check the result from handleError?
536                    this._zoneDelegate.handleError(this, err);
537                    throw err;
538                }
539                if (task._zoneDelegates === zoneDelegates) {
540                    // we have to check because internally the delegate can reschedule the task.
541                    this._updateTaskCount(task, 1);
542                }
543                if (task.state == scheduling) {
544                    task._transitionTo(scheduled, scheduling);
545                }
546                return task;
547            }
548            scheduleMicroTask(source, callback, data, customSchedule) {
549                return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined));
550            }
551            scheduleMacroTask(source, callback, data, customSchedule, customCancel) {
552                return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
553            }
554            scheduleEventTask(source, callback, data, customSchedule, customCancel) {
555                return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel));
556            }
557            cancelTask(task) {
558                if (task.zone != this)
559                    throw new Error('A task can only be cancelled in the zone of creation! (Creation: ' +
560                        (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');
561                task._transitionTo(canceling, scheduled, running);
562                try {
563                    this._zoneDelegate.cancelTask(this, task);
564                }
565                catch (err) {
566                    // if error occurs when cancelTask, transit the state to unknown
567                    task._transitionTo(unknown, canceling);
568                    this._zoneDelegate.handleError(this, err);
569                    throw err;
570                }
571                this._updateTaskCount(task, -1);
572                task._transitionTo(notScheduled, canceling);
573                task.runCount = 0;
574                return task;
575            }
576            _updateTaskCount(task, count) {
577                const zoneDelegates = task._zoneDelegates;
578                if (count == -1) {
579                    task._zoneDelegates = null;
580                }
581                for (let i = 0; i < zoneDelegates.length; i++) {
582                    zoneDelegates[i]._updateTaskCount(task.type, count);
583                }
584            }
585        }
586        // tslint:disable-next-line:require-internal-with-underscore
587        Zone.__symbol__ = __symbol__;
588        const DELEGATE_ZS = {
589            name: '',
590            onHasTask: (delegate, _, target, hasTaskState) => delegate.hasTask(target, hasTaskState),
591            onScheduleTask: (delegate, _, target, task) => delegate.scheduleTask(target, task),
592            onInvokeTask: (delegate, _, target, task, applyThis, applyArgs) => delegate.invokeTask(target, task, applyThis, applyArgs),
593            onCancelTask: (delegate, _, target, task) => delegate.cancelTask(target, task)
594        };
595        class ZoneDelegate {
596            constructor(zone, parentDelegate, zoneSpec) {
597                this._taskCounts = { 'microTask': 0, 'macroTask': 0, 'eventTask': 0 };
598                this.zone = zone;
599                this._parentDelegate = parentDelegate;
600                this._forkZS =
601                    zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);
602                this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);
603                this._forkCurrZone =
604                    zoneSpec && (zoneSpec.onFork ? this.zone : parentDelegate._forkCurrZone);
605                this._interceptZS =
606                    zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);
607                this._interceptDlgt =
608                    zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);
609                this._interceptCurrZone =
610                    zoneSpec && (zoneSpec.onIntercept ? this.zone : parentDelegate._interceptCurrZone);
611                this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);
612                this._invokeDlgt =
613                    zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);
614                this._invokeCurrZone =
615                    zoneSpec && (zoneSpec.onInvoke ? this.zone : parentDelegate._invokeCurrZone);
616                this._handleErrorZS =
617                    zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);
618                this._handleErrorDlgt = zoneSpec &&
619                    (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);
620                this._handleErrorCurrZone =
621                    zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate._handleErrorCurrZone);
622                this._scheduleTaskZS =
623                    zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
624                this._scheduleTaskDlgt = zoneSpec &&
625                    (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
626                this._scheduleTaskCurrZone = zoneSpec &&
627                    (zoneSpec.onScheduleTask ? this.zone : parentDelegate._scheduleTaskCurrZone);
628                this._invokeTaskZS =
629                    zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);
630                this._invokeTaskDlgt =
631                    zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);
632                this._invokeTaskCurrZone =
633                    zoneSpec && (zoneSpec.onInvokeTask ? this.zone : parentDelegate._invokeTaskCurrZone);
634                this._cancelTaskZS =
635                    zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);
636                this._cancelTaskDlgt =
637                    zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);
638                this._cancelTaskCurrZone =
639                    zoneSpec && (zoneSpec.onCancelTask ? this.zone : parentDelegate._cancelTaskCurrZone);
640                this._hasTaskZS = null;
641                this._hasTaskDlgt = null;
642                this._hasTaskDlgtOwner = null;
643                this._hasTaskCurrZone = null;
644                const zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask;
645                const parentHasTask = parentDelegate && parentDelegate._hasTaskZS;
646                if (zoneSpecHasTask || parentHasTask) {
647                    // If we need to report hasTask, than this ZS needs to do ref counting on tasks. In such
648                    // a case all task related interceptors must go through this ZD. We can't short circuit it.
649                    this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS;
650                    this._hasTaskDlgt = parentDelegate;
651                    this._hasTaskDlgtOwner = this;
652                    this._hasTaskCurrZone = zone;
653                    if (!zoneSpec.onScheduleTask) {
654                        this._scheduleTaskZS = DELEGATE_ZS;
655                        this._scheduleTaskDlgt = parentDelegate;
656                        this._scheduleTaskCurrZone = this.zone;
657                    }
658                    if (!zoneSpec.onInvokeTask) {
659                        this._invokeTaskZS = DELEGATE_ZS;
660                        this._invokeTaskDlgt = parentDelegate;
661                        this._invokeTaskCurrZone = this.zone;
662                    }
663                    if (!zoneSpec.onCancelTask) {
664                        this._cancelTaskZS = DELEGATE_ZS;
665                        this._cancelTaskDlgt = parentDelegate;
666                        this._cancelTaskCurrZone = this.zone;
667                    }
668                }
669            }
670            fork(targetZone, zoneSpec) {
671                return this._forkZS ?
672                    this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) :
673                    new Zone(targetZone, zoneSpec);
674            }
675            intercept(targetZone, callback, source) {
676                return this._interceptZS ?
677                    this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) :
678                    callback;
679            }
680            invoke(targetZone, callback, applyThis, applyArgs, source) {
681                return this._invokeZS ?
682                    this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
683                    callback.apply(applyThis, applyArgs);
684            }
685            handleError(targetZone, error) {
686                return this._handleErrorZS ?
687                    this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) :
688                    true;
689            }
690            scheduleTask(targetZone, task) {
691                let returnTask = task;
692                if (this._scheduleTaskZS) {
693                    if (this._hasTaskZS) {
694                        returnTask._zoneDelegates.push(this._hasTaskDlgtOwner);
695                    }
696                    // clang-format off
697                    returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task);
698                    // clang-format on
699                    if (!returnTask)
700                        returnTask = task;
701                }
702                else {
703                    if (task.scheduleFn) {
704                        task.scheduleFn(task);
705                    }
706                    else if (task.type == microTask) {
707                        scheduleMicroTask(task);
708                    }
709                    else {
710                        throw new Error('Task is missing scheduleFn.');
711                    }
712                }
713                return returnTask;
714            }
715            invokeTask(targetZone, task, applyThis, applyArgs) {
716                return this._invokeTaskZS ?
717                    this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
718                    task.callback.apply(applyThis, applyArgs);
719            }
720            cancelTask(targetZone, task) {
721                let value;
722                if (this._cancelTaskZS) {
723                    value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task);
724                }
725                else {
726                    if (!task.cancelFn) {
727                        throw Error('Task is not cancelable');
728                    }
729                    value = task.cancelFn(task);
730                }
731                return value;
732            }
733            hasTask(targetZone, isEmpty) {
734                // hasTask should not throw error so other ZoneDelegate
735                // can still trigger hasTask callback
736                try {
737                    this._hasTaskZS &&
738                        this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
739                }
740                catch (err) {
741                    this.handleError(targetZone, err);
742                }
743            }
744            // tslint:disable-next-line:require-internal-with-underscore
745            _updateTaskCount(type, count) {
746                const counts = this._taskCounts;
747                const prev = counts[type];
748                const next = counts[type] = prev + count;
749                if (next < 0) {
750                    throw new Error('More tasks executed then were scheduled.');
751                }
752                if (prev == 0 || next == 0) {
753                    const isEmpty = {
754                        microTask: counts['microTask'] > 0,
755                        macroTask: counts['macroTask'] > 0,
756                        eventTask: counts['eventTask'] > 0,
757                        change: type
758                    };
759                    this.hasTask(this.zone, isEmpty);
760                }
761            }
762        }
763        class ZoneTask {
764            constructor(type, source, callback, options, scheduleFn, cancelFn) {
765                // tslint:disable-next-line:require-internal-with-underscore
766                this._zone = null;
767                this.runCount = 0;
768                // tslint:disable-next-line:require-internal-with-underscore
769                this._zoneDelegates = null;
770                // tslint:disable-next-line:require-internal-with-underscore
771                this._state = 'notScheduled';
772                this.type = type;
773                this.source = source;
774                this.data = options;
775                this.scheduleFn = scheduleFn;
776                this.cancelFn = cancelFn;
777                if (!callback) {
778                    throw new Error('callback is not defined');
779                }
780                this.callback = callback;
781                const self = this;
782                // TODO: @JiaLiPassion options should have interface
783                if (type === eventTask && options && options.useG) {
784                    this.invoke = ZoneTask.invokeTask;
785                }
786                else {
787                    this.invoke = function () {
788                        return ZoneTask.invokeTask.call(global, self, this, arguments);
789                    };
790                }
791            }
792            static invokeTask(task, target, args) {
793                if (!task) {
794                    task = this;
795                }
796                _numberOfNestedTaskFrames++;
797                try {
798                    task.runCount++;
799                    return task.zone.runTask(task, target, args);
800                }
801                finally {
802                    if (_numberOfNestedTaskFrames == 1) {
803                        drainMicroTaskQueue();
804                    }
805                    _numberOfNestedTaskFrames--;
806                }
807            }
808            get zone() { return this._zone; }
809            get state() { return this._state; }
810            cancelScheduleRequest() { this._transitionTo(notScheduled, scheduling); }
811            // tslint:disable-next-line:require-internal-with-underscore
812            _transitionTo(toState, fromState1, fromState2) {
813                if (this._state === fromState1 || this._state === fromState2) {
814                    this._state = toState;
815                    if (toState == notScheduled) {
816                        this._zoneDelegates = null;
817                    }
818                }
819                else {
820                    throw new Error(`${this.type} '${this.source}': can not transition to '${toState}', expecting state '${fromState1}'${fromState2 ? ' or \'' + fromState2 + '\'' : ''}, was '${this._state}'.`);
821                }
822            }
823            toString() {
824                if (this.data && typeof this.data.handleId !== 'undefined') {
825                    return this.data.handleId.toString();
826                }
827                else {
828                    return Object.prototype.toString.call(this);
829                }
830            }
831            // add toJSON method to prevent cyclic error when
832            // call JSON.stringify(zoneTask)
833            toJSON() {
834                return {
835                    type: this.type,
836                    state: this.state,
837                    source: this.source,
838                    zone: this.zone.name,
839                    runCount: this.runCount
840                };
841            }
842        }
843        //////////////////////////////////////////////////////
844        //////////////////////////////////////////////////////
845        ///  MICROTASK QUEUE
846        //////////////////////////////////////////////////////
847        //////////////////////////////////////////////////////
848        const symbolSetTimeout = __symbol__('setTimeout');
849        const symbolPromise = __symbol__('Promise');
850        const symbolThen = __symbol__('then');
851        let _microTaskQueue = [];
852        let _isDrainingMicrotaskQueue = false;
853        let nativeMicroTaskQueuePromise;
854        function scheduleMicroTask(task) {
855            // if we are not running in any task, and there has not been anything scheduled
856            // we must bootstrap the initial task creation by manually scheduling the drain
857            if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) {
858                // We are not running in Task, so we need to kickstart the microtask queue.
859                if (!nativeMicroTaskQueuePromise) {
860                    if (global[symbolPromise]) {
861                        nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);
862                    }
863                }
864                if (nativeMicroTaskQueuePromise) {
865                    let nativeThen = nativeMicroTaskQueuePromise[symbolThen];
866                    if (!nativeThen) {
867                        // native Promise is not patchable, we need to use `then` directly
868                        // issue 1078
869                        nativeThen = nativeMicroTaskQueuePromise['then'];
870                    }
871                    nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
872                }
873                else {
874                    global[symbolSetTimeout](drainMicroTaskQueue, 0);
875                }
876            }
877            task && _microTaskQueue.push(task);
878        }
879        function drainMicroTaskQueue() {
880            if (!_isDrainingMicrotaskQueue) {
881                _isDrainingMicrotaskQueue = true;
882                while (_microTaskQueue.length) {
883                    const queue = _microTaskQueue;
884                    _microTaskQueue = [];
885                    for (let i = 0; i < queue.length; i++) {
886                        const task = queue[i];
887                        try {
888                            task.zone.runTask(task, null, null);
889                        }
890                        catch (error) {
891                            _api.onUnhandledError(error);
892                        }
893                    }
894                }
895                _api.microtaskDrainDone();
896                _isDrainingMicrotaskQueue = false;
897            }
898        }
899        //////////////////////////////////////////////////////
900        //////////////////////////////////////////////////////
901        ///  BOOTSTRAP
902        //////////////////////////////////////////////////////
903        //////////////////////////////////////////////////////
904        const NO_ZONE = { name: 'NO ZONE' };
905        const notScheduled = 'notScheduled', scheduling = 'scheduling', scheduled = 'scheduled', running = 'running', canceling = 'canceling', unknown = 'unknown';
906        const microTask = 'microTask', macroTask = 'macroTask', eventTask = 'eventTask';
907        const patches = {};
908        const _api = {
909            symbol: __symbol__,
910            currentZoneFrame: () => _currentZoneFrame,
911            onUnhandledError: noop,
912            microtaskDrainDone: noop,
913            scheduleMicroTask: scheduleMicroTask,
914            showUncaughtError: () => !Zone[__symbol__('ignoreConsoleErrorUncaughtError')],
915            patchEventTarget: () => [],
916            patchOnProperties: noop,
917            patchMethod: () => noop,
918            bindArguments: () => [],
919            patchThen: () => noop,
920            patchMacroTask: () => noop,
921            setNativePromise: (NativePromise) => {
922                // sometimes NativePromise.resolve static function
923                // is not ready yet, (such as core-js/es6.promise)
924                // so we need to check here.
925                if (NativePromise && typeof NativePromise.resolve === 'function') {
926                    nativeMicroTaskQueuePromise = NativePromise.resolve(0);
927                }
928            },
929            patchEventPrototype: () => noop,
930            isIEOrEdge: () => false,
931            getGlobalObjects: () => undefined,
932            ObjectDefineProperty: () => noop,
933            ObjectGetOwnPropertyDescriptor: () => undefined,
934            ObjectCreate: () => undefined,
935            ArraySlice: () => [],
936            patchClass: () => noop,
937            wrapWithCurrentZone: () => noop,
938            filterProperties: () => [],
939            attachOriginToPatched: () => noop,
940            _redefineProperty: () => noop,
941            patchCallbacks: () => noop
942        };
943        let _currentZoneFrame = { parent: null, zone: new Zone(null, null) };
944        let _currentTask = null;
945        let _numberOfNestedTaskFrames = 0;
946        function noop() { }
947        performanceMeasure('Zone', 'Zone');
948        return global['Zone'] = Zone;
949    })(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
950
951    /**
952     * @license
953     * Copyright Google Inc. All Rights Reserved.
954     *
955     * Use of this source code is governed by an MIT-style license that can be
956     * found in the LICENSE file at https://angular.io/license
957     */
958    Zone.__load_patch('ZoneAwarePromise', (global, Zone, api) => {
959        const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
960        const ObjectDefineProperty = Object.defineProperty;
961        function readableObjectToString(obj) {
962            if (obj && obj.toString === Object.prototype.toString) {
963                const className = obj.constructor && obj.constructor.name;
964                return (className ? className : '') + ': ' + JSON.stringify(obj);
965            }
966            return obj ? obj.toString() : Object.prototype.toString.call(obj);
967        }
968        const __symbol__ = api.symbol;
969        const _uncaughtPromiseErrors = [];
970        const isDisableWrappingUncaughtPromiseRejection = global[__symbol__('DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION')] === true;
971        const symbolPromise = __symbol__('Promise');
972        const symbolThen = __symbol__('then');
973        const creationTrace = '__creationTrace__';
974        api.onUnhandledError = (e) => {
975            if (api.showUncaughtError()) {
976                const rejection = e && e.rejection;
977                if (rejection) {
978                    console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined);
979                }
980                else {
981                    console.error(e);
982                }
983            }
984        };
985        api.microtaskDrainDone = () => {
986            while (_uncaughtPromiseErrors.length) {
987                const uncaughtPromiseError = _uncaughtPromiseErrors.shift();
988                try {
989                    uncaughtPromiseError.zone.runGuarded(() => { throw uncaughtPromiseError; });
990                }
991                catch (error) {
992                    handleUnhandledRejection(error);
993                }
994            }
995        };
vendor: 8,869 bytes, lines 996-1168
996        const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__('unhandledPromiseRejectionHandler');
997        function handleUnhandledRejection(e) {
998            api.onUnhandledError(e);
999            try {
1000                const handler = Zone[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL];
1001                if (typeof handler === 'function') {
1002                    handler.call(this, e);
1003                }
1004            }
1005            catch (err) {
1006            }
1007        }
1008        function isThenable(value) { return value && value.then; }
1009        function forwardResolution(value) { return value; }
1010        function forwardRejection(rejection) { return ZoneAwarePromise.reject(rejection); }
1011        const symbolState = __symbol__('state');
1012        const symbolValue = __symbol__('value');
1013        const symbolFinally = __symbol__('finally');
1014        const symbolParentPromiseValue = __symbol__('parentPromiseValue');
1015        const symbolParentPromiseState = __symbol__('parentPromiseState');
1016        const source = 'Promise.then';
1017        const UNRESOLVED = null;
1018        const RESOLVED = true;
1019        const REJECTED = false;
1020        const REJECTED_NO_CATCH = 0;
1021        function makeResolver(promise, state) {
1022            return (v) => {
1023                try {
1024                    resolvePromise(promise, state, v);
1025                }
1026                catch (err) {
1027                    resolvePromise(promise, false, err);
1028                }
1029                // Do not return value or you will break the Promise spec.
1030            };
1031        }
1032        const once = function () {
1033            let wasCalled = false;
1034            return function wrapper(wrappedFunction) {
1035                return function () {
1036                    if (wasCalled) {
1037                        return;
1038                    }
1039                    wasCalled = true;
1040                    wrappedFunction.apply(null, arguments);
1041                };
1042            };
1043        };
1044        const TYPE_ERROR = 'Promise resolved with itself';
1045        const CURRENT_TASK_TRACE_SYMBOL = __symbol__('currentTaskTrace');
1046        // Promise Resolution
1047        function resolvePromise(promise, state, value) {
1048            const onceWrapper = once();
1049            if (promise === value) {
1050                throw new TypeError(TYPE_ERROR);
1051            }
1052            if (promise[symbolState] === UNRESOLVED) {
1053                // should only get value.then once based on promise spec.
1054                let then = null;
1055                try {
1056                    if (typeof value === 'object' || typeof value === 'function') {
1057                        then = value && value.then;
1058                    }
1059                }
1060                catch (err) {
1061                    onceWrapper(() => { resolvePromise(promise, false, err); })();
1062                    return promise;
1063                }
1064                // if (value instanceof ZoneAwarePromise) {
1065                if (state !== REJECTED && value instanceof ZoneAwarePromise &&
1066                    value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) &&
1067                    value[symbolState] !== UNRESOLVED) {
1068                    clearRejectedNoCatch(value);
1069                    resolvePromise(promise, value[symbolState], value[symbolValue]);
1070                }
1071                else if (state !== REJECTED && typeof then === 'function') {
1072                    try {
1073                        then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false)));
1074                    }
1075                    catch (err) {
1076                        onceWrapper(() => { resolvePromise(promise, false, err); })();
1077                    }
1078                }
1079                else {
1080                    promise[symbolState] = state;
1081                    const queue = promise[symbolValue];
1082                    promise[symbolValue] = value;
1083                    if (promise[symbolFinally] === symbolFinally) {
1084                        // the promise is generated by Promise.prototype.finally
1085                        if (state === RESOLVED) {
1086                            // the state is resolved, should ignore the value
1087                            // and use parent promise value
1088                            promise[symbolState] = promise[symbolParentPromiseState];
1089                            promise[symbolValue] = promise[symbolParentPromiseValue];
1090                        }
1091                    }
1092                    // record task information in value when error occurs, so we can
1093                    // do some additional work such as render longStackTrace
1094                    if (state === REJECTED && value instanceof Error) {
1095                        // check if longStackTraceZone is here
1096                        const trace = Zone.currentTask && Zone.currentTask.data &&
1097                            Zone.currentTask.data[creationTrace];
1098                        if (trace) {
1099                            // only keep the long stack trace into error when in longStackTraceZone
1100                            ObjectDefineProperty(value, CURRENT_TASK_TRACE_SYMBOL, { configurable: true, enumerable: false, writable: true, value: trace });
1101                        }
1102                    }
1103                    for (let i = 0; i < queue.length;) {
1104                        scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);
1105                    }
1106                    if (queue.length == 0 && state == REJECTED) {
1107                        promise[symbolState] = REJECTED_NO_CATCH;
1108                        let uncaughtPromiseError = value;
1109                        if (!isDisableWrappingUncaughtPromiseRejection) {
1110                            // If disable wrapping uncaught promise reject
1111                            // and the rejected value is an Error object,
1112                            // use the value instead of wrapping it.
1113                            try {
1114                                // Here we throws a new Error to print more readable error log
1115                                // and if the value is not an error, zone.js builds an `Error`
1116                                // Object here to attach the stack information.
1117                                throw new Error('Uncaught (in promise): ' + readableObjectToString(value) +
1118                                    (value && value.stack ? '\n' + value.stack : ''));
1119                            }
1120                            catch (err) {
1121                                uncaughtPromiseError = err;
1122                            }
1123                        }
1124                        uncaughtPromiseError.rejection = value;
1125                        uncaughtPromiseError.promise = promise;
1126                        uncaughtPromiseError.zone = Zone.current;
1127                        uncaughtPromiseError.task = Zone.currentTask;
1128                        _uncaughtPromiseErrors.push(uncaughtPromiseError);
1129                        api.scheduleMicroTask(); // to make sure that it is running
1130                    }
1131                }
1132            }
1133            // Resolving an already resolved promise is a noop.
1134            return promise;
1135        }
1136        const REJECTION_HANDLED_HANDLER = __symbol__('rejectionHandledHandler');
1137        function clearRejectedNoCatch(promise) {
1138            if (promise[symbolState] === REJECTED_NO_CATCH) {
1139                // if the promise is rejected no catch status
1140                // and queue.length > 0, means there is a error handler
1141                // here to handle the rejected promise, we should trigger
1142                // windows.rejectionhandled eventHandler or nodejs rejectionHandled
1143                // eventHandler
1144                try {
1145                    const handler = Zone[REJECTION_HANDLED_HANDLER];
1146                    if (handler && typeof handler === 'function') {
1147                        handler.call(this, { rejection: promise[symbolValue], promise: promise });
1148                    }
1149                }
1150                catch (err) {
1151                }
1152                promise[symbolState] = REJECTED;
1153                for (let i = 0; i < _uncaughtPromiseErrors.length; i++) {
1154                    if (promise === _uncaughtPromiseErrors[i].promise) {
1155                        _uncaughtPromiseErrors.splice(i, 1);
1156                    }
1157                }
1158            }
1159        }
1160        function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {
1161            clearRejectedNoCatch(promise);
1162            const promiseState = promise[symbolState];
1163            const delegate = promiseState ?
1164                (typeof onFulfilled === 'function') ? onFulfilled : forwardResolution :
1165                (typeof onRejected === 'function') ? onRejected : forwardRejection;
1166            zone.scheduleMicroTask(source, () => {
1167                try {
1168                    const parentPromiseValue = promise[symbolValue];
1169                    const isFinallyPromise = !!chainPromise && symbolFinally === chainPromise[symbolFinally];
1170                    if (isFinallyPromise) {
1171                        // if the promise is generated from finally call, keep parent promise's state and value
1172                        chainPromise[symbolParentPromiseValue] = parentPromiseValue;
1173                        chainPromise[symbolParentPromiseState] = promiseState;
1174                    }
1175                    // should not pass value to finally callback
1176                    const value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ?
1177                        [] :
1178                        [parentPromiseValue]);
1179                    resolvePromise(chainPromise, true, value);
1180                }
1181                catch (error) {
1182                    // if error occurs, should always return this error
1183                    resolvePromise(chainPromise, false, error);
1184                }
1185            }, chainProm
vendor: 5,843 bytes, lines 1185-1318
1185ise);
1186        }
1187        const ZONE_AWARE_PROMISE_TO_STRING = 'function ZoneAwarePromise() { [native code] }';
1188        const noop = function () { };
1189        class ZoneAwarePromise {
1190            static toString() { return ZONE_AWARE_PROMISE_TO_STRING; }
1191            static resolve(value) {
1192                return resolvePromise(new this(null), RESOLVED, value);
1193            }
1194            static reject(error) {
1195                return resolvePromise(new this(null), REJECTED, error);
1196            }
1197            static race(values) {
1198                let resolve;
1199                let reject;
1200                let promise = new this((res, rej) => {
1201                    resolve = res;
1202                    reject = rej;
1203                });
1204                function onResolve(value) { resolve(value); }
1205                function onReject(error) { reject(error); }
1206                for (let value of values) {
1207                    if (!isThenable(value)) {
1208                        value = this.resolve(value);
1209                    }
1210                    value.then(onResolve, onReject);
1211                }
1212                return promise;
1213            }
1214            static all(values) { return ZoneAwarePromise.allWithCallback(values); }
1215            static allSettled(values) {
1216                const P = this && this.prototype instanceof ZoneAwarePromise ? this : ZoneAwarePromise;
1217                return P.allWithCallback(values, {
1218                    thenCallback: (value) => ({ status: 'fulfilled', value }),
1219                    errorCallback: (err) => ({ status: 'rejected', reason: err })
1220                });
1221            }
1222            static allWithCallback(values, callback) {
1223                let resolve;
1224                let reject;
1225                let promise = new this((res, rej) => {
1226                    resolve = res;
1227                    reject = rej;
1228                });
1229                // Start at 2 to prevent prematurely resolving if .then is called immediately.
1230                let unresolvedCount = 2;
1231                let valueIndex = 0;
1232                const resolvedValues = [];
1233                for (let value of values) {
1234                    if (!isThenable(value)) {
1235                        value = this.resolve(value);
1236                    }
1237                    const curValueIndex = valueIndex;
1238                    try {
1239                        value.then((value) => {
1240                            resolvedValues[curValueIndex] = callback ? callback.thenCallback(value) : value;
1241                            unresolvedCount--;
1242                            if (unresolvedCount === 0) {
1243                                resolve(resolvedValues);
1244                            }
1245                        }, (err) => {
1246                            if (!callback) {
1247                                reject(err);
1248                            }
1249                            else {
1250                                resolvedValues[curValueIndex] = callback.errorCallback(err);
1251                                unresolvedCount--;
1252                                if (unresolvedCount === 0) {
1253                                    resolve(resolvedValues);
1254                                }
1255                            }
1256                        });
1257                    }
1258                    catch (thenErr) {
1259                        reject(thenErr);
1260                    }
1261                    unresolvedCount++;
1262                    valueIndex++;
1263                }
1264                // Make the unresolvedCount zero-based again.
1265                unresolvedCount -= 2;
1266                if (unresolvedCount === 0) {
1267                    resolve(resolvedValues);
1268                }
1269                return promise;
1270            }
1271            constructor(executor) {
1272                const promise = this;
1273                if (!(promise instanceof ZoneAwarePromise)) {
1274                    throw new Error('Must be an instanceof Promise.');
1275                }
1276                promise[symbolState] = UNRESOLVED;
1277                promise[symbolValue] = []; // queue;
1278                try {
1279                    executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));
1280                }
1281                catch (error) {
1282                    resolvePromise(promise, false, error);
1283                }
1284            }
1285            get [Symbol.toStringTag]() { return 'Promise'; }
1286            get [Symbol.species]() { return ZoneAwarePromise; }
1287            then(onFulfilled, onRejected) {
1288                let C = this.constructor[Symbol.species];
1289                if (!C || typeof C !== 'function') {
1290                    C = this.constructor || ZoneAwarePromise;
1291                }
1292                const chainPromise = new C(noop);
1293                const zone = Zone.current;
1294                if (this[symbolState] == UNRESOLVED) {
1295                    this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);
1296                }
1297                else {
1298                    scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);
1299                }
1300                return chainPromise;
1301            }
1302            catch(onRejected) {
1303                return this.then(null, onRejected);
1304            }
1305            finally(onFinally) {
1306                let C = this.constructor[Symbol.species];
1307                if (!C || typeof C !== 'function') {
1308                    C = ZoneAwarePromise;
1309                }
1310                const chainPromise = new C(noop);
1311                chainPromise[symbolFinally] = symbolFinally;
1312                const zone = Zone.current;
1313                if (this[symbolState] == UNRESOLVED) {
1314                    this[symbolValue].push(zone, chainPromise, onFinally, onFinally);
1315                }
1316                else {
1317                    scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally);
1318                }
1319                return chainPromise;
1320            }
1321        }
1322        // Protect against aggressive optimizers dropping seemingly unused properties.
1323        // E.g. Closure Compiler in advanced mode.
1324        ZoneAwarePromise['resolve'] = ZoneAwarePromise.resolve;
1325        ZoneAwarePromise['reject'] = ZoneAwarePromise.reject;
1326        ZoneAwarePromise['race'] = ZoneAwarePromise.race;
1327        ZoneAwarePromise['all'] = ZoneAwarePromise.all;
1328        const NativePromise = global[symbolPromise] = global['Promise'];
1329        const ZONE_AWARE_PROMISE = Zone.__symbol__('ZoneAwarePromise');
1330        let desc = ObjectGetOwnPropertyDescriptor(global, 'Promise');
1331        if (!desc || desc.configurable) {
1332            desc && delete desc.writable;
1333            desc && delete desc.value;
1334            if (!desc) {
1335                desc = { configurable: true, enumerable: true };
1336            }
1337            desc.get = function () {
1338                // if we already set ZoneAwarePromise, use patched one
1339                // otherwise return native one.
1340                return global[ZONE_AWARE_PROMISE] ? global[ZONE_AWARE_PROMISE] : global[symbolPromise];
1341            };
1342            desc.set = function (NewNativePromise) {
1343                if (NewNativePromise === ZoneAwarePromise) {
1344                    // if the NewNativePromise is ZoneAwarePromise
1345                    // save to global
1346                    global[ZONE_AWARE_PROMISE] = NewNativePromise;
1347                }
1348                else {
1349                    // if the NewNativePromise is not ZoneAwarePromise
1350                    // for example: after load zone.js, some library just
1351                    // set es6-promise to global, if we set it to global
1352                    // directly, assertZonePatched will fail and angular
1353                    // will not loaded, so we just set the NewNativePromise
1354                    // to global[symbolPromise], so the result is just like
1355                    // we load ES6 Promise before zone.js
1356                    global[symbolPromise] = NewNativePromise;
1357                    if (!NewNativePromise.prototype[symbolThen]) {
1358                        patchThen(NewNativePromise);
1359                    }
1360                    api.setNativePromise(NewNativePromise);
1361                }
1362            };
1363            ObjectDefineProperty(global, 'Promise', desc);
1364        }
1365        global['Promise'] = ZoneAwarePromise;
1366        const symbolThenPatched = __symbol__('thenPatched');
1367        function patchThen(Ctor) {
1368            const proto = Ctor.prototype;
1369            const prop = ObjectGetOwnPropertyDescriptor(proto, 'then');
1370            if (prop && (prop.writable === false || !prop.configurable)) {
1371                // check Ctor.prototype.then propertyDescriptor is writable or not
1372                // in meteor env, writable is false, we should ignore such case
1373                return;
1374            }
1375            const originalThen = proto.then;
1376            // Keep a reference to the original method.
1377            proto[symbolThen] = originalThen;
1378            Ctor.prototype.then = function (onResolve, onReject) {
1379                const wrapped = new ZoneAwarePromise((resolve, reject) => { originalThen.call(this, resolve, reject); });
1380                return wrapped.then(onResolve, onReject);
1381            };
1382            Ctor[symbolThenPatched] = true;
1383        }
1384        api.patchThen = patchThen;
1385        function zoneify(fn) {
1386            return function () {
1387                let resultPromise = fn.apply(this, arguments);
1388                if (resultPromise instanceof ZoneAwarePromise) {
1389                    return resultPromise;
1390                }
1391                let ctor = resultPromise.constructor;
1392                if (!ctor[symbolThenPatched]) {
1393                    patchThen(ctor);
1394                }
1395                return resultPromise;
1396            };
1397        }
1398        if (NativePromise) {
1399            patchThen(NativePromise);
1400            const fetch = global['fetch'];
1401            if (typeof fetch == 'function') {
1402                global[api.symbol('fetch')] = fetch;
1403                global['fetch'] = zoneify(fetch);
1404            }
1405        }
1406        // This is not part of public API, but it is useful for tests, so we expose it.
1407        Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
1408        return ZoneAwarePromise;
1409    });
1410
1411    /**
1412     * @license
1413     * Copyright Google Inc. All Rights Reserved.
1414     *
1415     * Use of this source code is governed by an MIT-style license that can be
1416     * found in the LICENSE file at https://angular.io/license
1417     */
1418    /**
1419     * Suppress closure compiler errors about unknown 'Zone' variable
1420     * @fileoverview
1421     * @suppress {undefinedVars,globalThis,missingRequire}
1422     */
1423    /// <reference types="node"/>
1424    // issue #989, to reduce bundle size, use short name
1425    /** Object.getOwnPropertyDescriptor */
1426    const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1427    /** Object.defineProperty */
1428    const ObjectDefineProperty = Object.defineProperty;
1429    /** Object.getPrototypeOf */
1430    const ObjectGetPrototypeOf = Object.getPrototypeOf;
1431    /** Object.create */
1432    const ObjectCreate = Object.create;
1433    /** Array.prototype.slice */
1434    const ArraySlice = Array.prototype.slice;
1435    /** addEventListener string const */
1436    const ADD_EVENT_LISTENER_STR = 'addEventListener';
1437    /** removeEventListener string const */
1438    const REMOVE_EVENT_LISTENER_STR = 'removeEventListener';
1439    /** zoneSymbol addEventListener */
1440    const ZONE_SYMBOL_ADD_EVENT_LISTENER = Zone.__symbol__(ADD_EVENT_LISTENER_STR);
1441    /** zoneSymbol removeEventListener */
1442    const ZONE_SYMBOL_REMOVE_EVENT_LISTENER = Zone.__symbol__(REMOVE_EVENT_LISTENER_STR);
1443    /** true string const */
1444    const TRUE_STR = 'true';
1445    /** false string const */
1446    const FALSE_STR = 'false';
1447    /** Zone symbol prefix string const. */
1448    const ZONE_SYMBOL_PREFIX = Zone.__symbol__('');
1449    function wrapWithCurrentZone(callback, source) {
1450        return Zone.current.wrap(callback, source);
1451    }
1452    function scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) {
1453        return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel);
1454    }
1455    const zoneSymbol = Zone.__symbol__;
1456    const isWindowExists = typeof window !== 'undefined';
1457    const internalWindow = isWindowExists ? window : undefined;
1458    const _global = isWindowExists && internalWindow || typeof self === 'object' && self || global;
1459    const REMOVE_ATTRIBUTE = 'removeAttribute';
1460    const NULL_ON_PROP_VALUE = [null];
1461    function bindArguments(args, source) {
1462        for (let i = args.length - 1; i >= 0; i--) {
1463            if (typeof args[i] === 'function') {
1464                args[i] = wrapWithCurrentZone(args[i], source + '_' + i);
1465            }
1466        }
1467        return args;
1468    }
1469    function patchPrototype(prototype, fnNames) {
1470        const source = prototype.constructor['name'];
1471        for (let i = 0; i < fnNames.length; i++) {
1472            const name = fnNames[i];
1473            const delegate = prototype[name];
1474            if (delegate) {
1475                const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name);
1476                if (!isPropertyWritable(prototypeDesc)) {
1477                    continue;
1478                }
1479                prototype[name] = ((delegate) => {
1480                    const patched = function () {
1481                        return delegate.apply(this, bindArguments(arguments, source + '.' + name));
1482                    };
1483                    attachOriginToPatched(patched, delegate);
1484                    return patched;
1485                })(delegate);
1486            }
1487        }
1488    }
1489    function isPropertyWritable(propertyDesc) {
1490        if (!propertyDesc) {
1491            return true;
1492        }
1493        if (propertyDesc.writable === false) {
1494            return false;
1495        }
1496        return !(typeof propertyDesc.get === 'function' && typeof propertyDesc.set === 'undefined');
1497    }
1498    const isWebWorker = (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope);
1499    // Make sure to access `process` through `_global` so that WebPack does not accidentally browserify
1500    // this code.
1501    const isNode = (!('nw' in _global) && typeof _global.process !== 'undefined' &&
1502        {}.toString.call(_global.process) === '[object process]');
1503    const isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']);
1504    // we are in electron of nw, so we are both browser and nodejs
1505    // Make sure to access `process` through `_global` so that WebPack does not accidentally browserify
1506    // this code.
1507    const isMix = typeof _global.process !== 'undefined' &&
1508        {}.toString.call(_global.process) === '[object process]' && !isWebWorker &&
1509        !!(isWindowExists && internalWindow['HTMLElement']);
1510    const zoneSymbolEventNames = {};
1511    const wrapFn = function (event) {
1512        // https://github.com/angular/zone.js/issues/911, in IE, sometimes
1513        // event will be undefined, so we need to use window.event
1514        event = event || _global.event;
1515        if (!event) {
1516            return;
1517        }
1518        let eventNameSymbol = zoneSymbolEventNames[event.type];
1519        if (!eventNameSymbol) {
1520            eventNameSymbol = zoneSymbolEventNames[event.type] = zoneSymbol('ON_PROPERTY' + event.type);
1521        }
1522        const target = this || event.target || _global;
1523        const listener = target[eventNameSymbol];
1524        let result;
1525        if (isBrowser && target === internalWindow && event.type === 'error') {
1526            // window.onerror have different signiture
1527            // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror
1528            // and onerror callback will prevent default when callback return true
1529            const errorEvent = event;
1530            result = listener &&
1531                listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);
1532            if (result === true) {
1533                event.preventDefault();
1534            }
1535        }
1536        else {
1537            result = listener && listener.apply(this, arguments);
1538            if (result != undefined && !result) {
1539                event.preventDefault();
1540            }
1541        }
1542        return result;
1543    };
1544    function patchProperty(obj, prop, prototype) {
1545        let desc = ObjectGetOwnPropertyDescriptor(obj, prop);
1546        if (!desc && prototype) {
1547            // when patch window object, use prototype to check prop exist or not
vendor: 7,887 bytes, lines 1548-1732
1548            const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop);
1549            if (prototypeDesc) {
1550                desc = { enumerable: true, configurable: true };
1551            }
1552        }
1553        // if the descriptor not exists or is not configurable
1554        // just return
1555        if (!desc || !desc.configurable) {
1556            return;
1557        }
1558        const onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');
1559        if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {
1560            return;
1561        }
1562        // A property descriptor cannot have getter/setter and be writable
1563        // deleting the writable and value properties avoids this error:
1564        //
1565        // TypeError: property descriptors must not specify a value or be writable when a
1566        // getter or setter has been specified
1567        delete desc.writable;
1568        delete desc.value;
1569        const originalDescGet = desc.get;
1570        const originalDescSet = desc.set;
1571        // substr(2) cuz 'onclick' -> 'click', etc
1572        const eventName = prop.substr(2);
1573        let eventNameSymbol = zoneSymbolEventNames[eventName];
1574        if (!eventNameSymbol) {
1575            eventNameSymbol = zoneSymbolEventNames[eventName] = zoneSymbol('ON_PROPERTY' + eventName);
1576        }
1577        desc.set = function (newValue) {
1578            // in some of windows's onproperty callback, this is undefined
1579            // so we need to check it
1580            let target = this;
1581            if (!target && obj === _global) {
1582                target = _global;
1583            }
1584            if (!target) {
1585                return;
1586            }
1587            let previousValue = target[eventNameSymbol];
1588            if (previousValue) {
1589                target.removeEventListener(eventName, wrapFn);
1590            }
1591            // issue #978, when onload handler was added before loading zone.js
1592            // we should remove it with originalDescSet
1593            if (originalDescSet) {
1594                originalDescSet.apply(target, NULL_ON_PROP_VALUE);
1595            }
1596            if (typeof newValue === 'function') {
1597                target[eventNameSymbol] = newValue;
1598                target.addEventListener(eventName, wrapFn, false);
1599            }
1600            else {
1601                target[eventNameSymbol] = null;
1602            }
1603        };
1604        // The getter would return undefined for unassigned properties but the default value of an
1605        // unassigned property is null
1606        desc.get = function () {
1607            // in some of windows's onproperty callback, this is undefined
1608            // so we need to check it
1609            let target = this;
1610            if (!target && obj === _global) {
1611                target = _global;
1612            }
1613            if (!target) {
1614                return null;
1615            }
1616            const listener = target[eventNameSymbol];
1617            if (listener) {
1618                return listener;
1619            }
1620            else if (originalDescGet) {
1621                // result will be null when use inline event attribute,
1622                // such as <button onclick="func();">OK</button>
1623                // because the onclick function is internal raw uncompiled handler
1624                // the onclick will be evaluated when first time event was triggered or
1625                // the property is accessed, https://github.com/angular/zone.js/issues/525
1626                // so we should use original native get to retrieve the handler
1627                let value = originalDescGet && originalDescGet.call(this);
1628                if (value) {
1629                    desc.set.call(this, value);
1630                    if (typeof target[REMOVE_ATTRIBUTE] === 'function') {
1631                        target.removeAttribute(prop);
1632                    }
1633                    return value;
1634                }
1635            }
1636            return null;
1637        };
1638        ObjectDefineProperty(obj, prop, desc);
1639        obj[onPropPatchedSymbol] = true;
1640    }
1641    function patchOnProperties(obj, properties, prototype) {
1642        if (properties) {
1643            for (let i = 0; i < properties.length; i++) {
1644                patchProperty(obj, 'on' + properties[i], prototype);
1645            }
1646        }
1647        else {
1648            const onProperties = [];
1649            for (const prop in obj) {
1650                if (prop.substr(0, 2) == 'on') {
1651                    onProperties.push(prop);
1652                }
1653            }
1654            for (let j = 0; j < onProperties.length; j++) {
1655                patchProperty(obj, onProperties[j], prototype);
1656            }
1657        }
1658    }
1659    const originalInstanceKey = zoneSymbol('originalInstance');
1660    // wrap some native API on `window`
1661    function patchClass(className) {
1662        const OriginalClass = _global[className];
1663        if (!OriginalClass)
1664            return;
1665        // keep original class in global
1666        _global[zoneSymbol(className)] = OriginalClass;
1667        _global[className] = function () {
1668            const a = bindArguments(arguments, className);
1669            switch (a.length) {
1670                case 0:
1671                    this[originalInstanceKey] = new OriginalClass();
1672                    break;
1673                case 1:
1674                    this[originalInstanceKey] = new OriginalClass(a[0]);
1675                    break;
1676                case 2:
1677                    this[originalInstanceKey] = new OriginalClass(a[0], a[1]);
1678                    break;
1679                case 3:
1680                    this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);
1681                    break;
1682                case 4:
1683                    this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);
1684                    break;
1685                default:
1686                    throw new Error('Arg list too long.');
1687            }
1688        };
1689        // attach original delegate to patched function
1690        attachOriginToPatched(_global[className], OriginalClass);
1691        const instance = new OriginalClass(function () { });
1692        let prop;
1693        for (prop in instance) {
1694            // https://bugs.webkit.org/show_bug.cgi?id=44721
1695            if (className === 'XMLHttpRequest' && prop === 'responseBlob')
1696                continue;
1697            (function (prop) {
1698                if (typeof instance[prop] === 'function') {
1699                    _global[className].prototype[prop] = function () {
1700                        return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments);
1701                    };
1702                }
1703                else {
1704                    ObjectDefineProperty(_global[className].prototype, prop, {
1705                        set: function (fn) {
1706                            if (typeof fn === 'function') {
1707                                this[originalInstanceKey][prop] = wrapWithCurrentZone(fn, className + '.' + prop);
1708                                // keep callback in wrapped function so we can
1709                                // use it in Function.prototype.toString to return
1710                                // the native one.
1711                                attachOriginToPatched(this[originalInstanceKey][prop], fn);
1712                            }
1713                            else {
1714                                this[originalInstanceKey][prop] = fn;
1715                            }
1716                        },
1717                        get: function () { return this[originalInstanceKey][prop]; }
1718                    });
1719                }
1720            }(prop));
1721        }
1722        for (prop in OriginalClass) {
1723            if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) {
1724                _global[className][prop] = OriginalClass[prop];
1725            }
1726        }
1727    }
1728    function copySymbolProperties(src, dest) {
1729        if (typeof Object.getOwnPropertySymbols !== 'function') {
1730            return;
1731        }
1732        const symbols = Object.getOwnPropertySymbols(src);
1733        symbols.forEach((symbol) => {
1734            const desc = Object.getOwnPropertyDescriptor(src, symbol);
1735            Object.defineProperty(dest, symbol, {
1736                get: function () { return src[symbol]; },
1737                set: function (value) {
1738                    if (desc && (!desc.writable || typeof desc.set !== 'function')) {
1739                        // if src[symbol] is not writable or not have a setter, just return
1740                        return;
1741                    }
1742                    src[symbol] = value;
1743                },
1744                enumerable: desc ? desc.enumerable : true,
1745                configurable: desc ? desc.configurable : true
1746            });
1747        });
1748    }
1749    let shouldCopySymbolProperties = false;
1750    function patchMethod(target, name, patchFn) {
1751        let proto = target;
1752        while (proto && !proto.hasOwnProperty(name)) {
1753            proto = ObjectGetPrototypeOf(proto);
1754        }
1755        if (!proto && target[name]) {
1756            // somehow we did not find it, but we can see it. This happens on IE for Window properties.
1757            proto = target;
1758        }
1759        const delegateName = zoneSymbol(name);
1760        let delegate = null;
1761        if (proto && !(delegate = proto[delegateName])) {
1762            delegate = proto[delegateName] = proto[name];
1763            // check whether proto[name] is writable
1764            // some property is readonly in safari, such as HtmlCanvasElement.prototype.toBlob
1765            const desc = proto && ObjectGetOwnPropertyDescriptor(proto, name);
1766            if (isPropertyWritable(desc)) {
1767                const patchDelegate = patchFn(delegate, delegateName, name);
1768                proto[name] = function () { return patchDelegate(this, arguments); };
1769                attachOriginToPatched(proto[name], delegate);
1770                if (shouldCopySymbolProperties) {
1771                    copySymbolProperties(delegate, proto[name]);
1772                }
1773            }
1774        }
1775        return delegate;
1776    }
1777    // TODO: @JiaLiPassion, support cancel task later if necessary
1778    function patchMacroTask(obj, funcName, metaCreator) {
1779        let setNative = null;
1780        function scheduleTask(task) {
1781            const data = task.data;
1782            data.args[data.cbIdx] = function () { task.invoke.apply(this, arguments); };
vendor: 4,167 bytes, lines 1783-1890
1783            setNative.apply(data.target, data.args);
1784            return task;
1785        }
1786        setNative = patchMethod(obj, funcName, (delegate) => function (self, args) {
1787            const meta = metaCreator(self, args);
1788            if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {
1789                return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);
1790            }
1791            else {
1792                // cause an error by calling it directly.
1793                return delegate.apply(self, args);
1794            }
1795        });
1796    }
1797    function attachOriginToPatched(patched, original) {
1798        patched[zoneSymbol('OriginalDelegate')] = original;
1799    }
1800    let isDetectedIEOrEdge = false;
1801    let ieOrEdge = false;
1802    function isIE() {
1803        try {
1804            const ua = internalWindow.navigator.userAgent;
1805            if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) {
1806                return true;
1807            }
1808        }
1809        catch (error) {
1810        }
1811        return false;
1812    }
1813    function isIEOrEdge() {
1814        if (isDetectedIEOrEdge) {
1815            return ieOrEdge;
1816        }
1817        isDetectedIEOrEdge = true;
1818        try {
1819            const ua = internalWindow.navigator.userAgent;
1820            if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1 || ua.indexOf('Edge/') !== -1) {
1821                ieOrEdge = true;
1822            }
1823        }
1824        catch (error) {
1825        }
1826        return ieOrEdge;
1827    }
1828
1829    /**
1830     * @license
1831     * Copyright Google Inc. All Rights Reserved.
1832     *
1833     * Use of this source code is governed by an MIT-style license that can be
1834     * found in the LICENSE file at https://angular.io/license
1835     */
1836    // override Function.prototype.toString to make zone.js patched function
1837    // look like native function
1838    Zone.__load_patch('toString', (global) => {
1839        // patch Func.prototype.toString to let them look like native
1840        const originalFunctionToString = Function.prototype.toString;
1841        const ORIGINAL_DELEGATE_SYMBOL = zoneSymbol('OriginalDelegate');
1842        const PROMISE_SYMBOL = zoneSymbol('Promise');
1843        const ERROR_SYMBOL = zoneSymbol('Error');
1844        const newFunctionToString = function toString() {
1845            if (typeof this === 'function') {
1846                const originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];
1847                if (originalDelegate) {
1848                    if (typeof originalDelegate === 'function') {
1849                        return originalFunctionToString.call(originalDelegate);
1850                    }
1851                    else {
1852                        return Object.prototype.toString.call(originalDelegate);
1853                    }
1854                }
1855                if (this === Promise) {
1856                    const nativePromise = global[PROMISE_SYMBOL];
1857                    if (nativePromise) {
1858                        return originalFunctionToString.call(nativePromise);
1859                    }
1860                }
1861                if (this === Error) {
1862                    const nativeError = global[ERROR_SYMBOL];
1863                    if (nativeError) {
1864                        return originalFunctionToString.call(nativeError);
1865                    }
1866                }
1867            }
1868            return originalFunctionToString.call(this);
1869        };
1870        newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;
1871        Function.prototype.toString = newFunctionToString;
1872        // patch Object.prototype.toString to let them look like native
1873        const originalObjectToString = Object.prototype.toString;
1874        const PROMISE_OBJECT_TO_STRING = '[object Promise]';
1875        Object.prototype.toString = function () {
1876            if (this instanceof Promise) {
1877                return PROMISE_OBJECT_TO_STRING;
1878            }
1879            return originalObjectToString.call(this);
1880        };
1881    });
1882
1883    /**
1884     * @license
1885     * Copyright Google Inc. All Rights Reserved.
1886     *
1887     * Use of this source code is governed by an MIT-style license that can be
1888     * found in the LICENSE file at https://angular.io/license
1889     */
1890    let passiveSupported = false;
1891    if (typeof window !== 'undefined') {
1892        try {
1893            const options = Object.defineProperty({}, 'passive', { get: function () { passiveSupported = true; } });
1894            window.addEventListener('test', options, options);
1895            window.removeEventListener('test', options, options);
1896        }
1897        catch (err) {
1898            passiveSupported = false;
1899        }
1900    }
1901    // an identifier to tell ZoneTask do not create a new invoke closure
1902    const OPTIMIZED_ZONE_EVENT_TASK_DATA = {
1903        useG: true
1904    };
1905    const zoneSymbolEventNames$1 = {};
1906    const globalSources = {};
1907    const EVENT_NAME_SYMBOL_REGX = new RegExp('^' + ZONE_SYMBOL_PREFIX + '(\\w+)(true|false)$');
1908    const IMMEDIATE_PROPAGATION_SYMBOL = zoneSymbol('propagationStopped');
1909    function prepareEventNames(eventName, eventNameToString) {
1910        const falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;
1911        const trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;
1912        const symbol = ZONE_SYMBOL_PREFIX + falseEventName;
1913        const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
1914        zoneSymbolEventNames$1[eventName] = {};
1915        zoneSymbolEventNames$1[eventName][FALSE_STR] = symbol;
1916        zoneSymbolEventNames$1[eventName][TRUE_STR] = symbolCapture;
1917    }
1918    function patchEventTarget(_global, apis, patchOptions) {
1919        const ADD_EVENT_LISTENER = (patchOptions && patchOptions.add) || ADD_EVENT_LISTENER_STR;
1920        const REMOVE_EVENT_LISTENER = (patchOptions && patchOptions.rm) || REMOVE_EVENT_LISTENER_STR;
1921        const LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.listeners) || 'eventListeners';
1922        const REMOVE_ALL_LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.rmAll) || 'removeAllListeners';
1923        const zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER);
1924        const ADD_EVENT_LISTENER_SOURCE = '.' + ADD_EVENT_LISTENER + ':';
1925        const PREPEND_EVENT_LISTENER = 'prependListener';
1926        const PREPEND_EVENT_LISTENER_SOURCE = '.' + PREPEND_EVENT_LISTENER + ':';
1927        const invokeTask = function (task, target, event) {
1928            // for better performance, check isRemoved which is set
1929            // by removeEventListener
1930            if (task.isRemoved) {
1931                return;
1932            }
1933            const delegate = task.callback;
1934            if (typeof delegate === 'object' && delegate.handleEvent) {
1935                // create the bind version of handleEvent when invoke
1936                task.callback = (event) => delegate.handleEvent(event);
1937                task.originalDelegate = delegate;
1938            }
1939            // invoke static task.invoke
1940            task.invoke(task, target, [event]);
1941            const options = task.options;
1942            if (options && typeof options === 'object' && options.once) {
1943                // if options.once is true, after invoke once remove listener here
1944                // only browser need to do this, nodejs eventEmitter will cal removeListener
1945                // inside EventEmitter.once
1946                const delegate = task.originalDelegate ? task.originalDelegate : task.callback;
1947                target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate, options);
1948            }
1949        };
1950        // global shared zoneAwareCallback to handle all event callback with capture = false
1951        const globalZoneAwareCallback = function (event) {
1952            // https://github.com/angular/zone.js/issues/911, in IE, sometimes
1953            // event will be undefined, so we need to use window.event
1954            event = event || _global.event;
1955            if (!event) {
1956                return;
1957            }
1958            // event.target is needed for Samsung TV and SourceBuffer
1959            // || global is needed https://github.com/angular/zone.js/issues/190
1960            const target = this || event.target || _global;
1961            const tasks = target[zoneSymbolEventNames$1[event.type][FALSE_STR]];
1962            if (tasks) {
1963                // invoke all tasks which attached to current target with given event.type and capture = false
1964                // for performance concern, if task.length === 1, just invoke
1965                if (tasks.length === 1) {
1966                    invokeTask(tasks[0], target, event);
1967                }
1968                else {
1969                    // https://github.com/angular/zone.js/issues/836
1970                    // copy the tasks array before invoke, to avoid
1971                    // the callback will remove itself or other listener
1972                    const copyTasks = tasks.slice();
1973                    for (let i = 0; i < copyTasks.length; i++) {
1974                        if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {
1975                            break;
1976                        }
1977                        invokeTask(copyTasks[i], target, event);
1978                    }
1979                }
1980            }
1981        };
1982        // global shared zoneAwareCallback to handle all event callback with capture = true
1983        const globalZoneAwareCaptureCallback = function (event) {
1984            // https://github.com/angular/zone.js/issues/911, in IE, sometimes
1985            // event will be undefined, so we need to use window.event
1986            event = event || _global.event;
1987            if (!event) {
1988                return;
1989            }
1990            // event.target is needed for Samsung TV and SourceBuffer
1991            // || global is needed https://github.com/angular/zone.js/issues/190
1992            const target = this || event.target || _global;
1993            const tasks = target[zoneSymbolEventNames$1[event.type][TRUE_STR]];
1994            if (tasks) {
1995                // invoke all tasks which attached to current target with given event.type and capture = false
1996                // for performance concern, if task.length === 1, just invoke
1997                if (tasks.length === 1) {
1998                    invokeTask(tasks[0], target, event);
1999                }
2000                else {
2001                    // https://github.com/angular/zone.js/issues/836
2002                    // copy the tasks array before invoke, to avoid
2003                    // the callback will remove itself or other listener
2004                    const copyTasks = tasks.slice();
2005                    for (let i = 0; i < copyTasks.length; i++) {
2006                        if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {
2007                            break;
2008                        }
2009                        invokeTask(copyTasks[i], target, event);
2010                    }
2011                }
2012            }
2013        };
2014        function patchEventTargetMethods(obj, patchOptions) {
2015            if (!obj) {
2016                return false;
vendor: 27,249 bytes, lines 2017-2548
2017            }
2018            let useGlobalCallback = true;
2019            if (patchOptions && patchOptions.useG !== undefined) {
2020                useGlobalCallback = patchOptions.useG;
2021            }
2022            const validateHandler = patchOptions && patchOptions.vh;
2023            let checkDuplicate = true;
2024            if (patchOptions && patchOptions.chkDup !== undefined) {
2025                checkDuplicate = patchOptions.chkDup;
2026            }
2027            let returnTarget = false;
2028            if (patchOptions && patchOptions.rt !== undefined) {
2029                returnTarget = patchOptions.rt;
2030            }
2031            let proto = obj;
2032            while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) {
2033                proto = ObjectGetPrototypeOf(proto);
2034            }
2035            if (!proto && obj[ADD_EVENT_LISTENER]) {
2036                // somehow we did not find it, but we can see it. This happens on IE for Window properties.
2037                proto = obj;
2038            }
2039            if (!proto) {
2040                return false;
2041            }
2042            if (proto[zoneSymbolAddEventListener]) {
2043                return false;
2044            }
2045            const eventNameToString = patchOptions && patchOptions.eventNameToString;
2046            // a shared global taskData to pass data for scheduleEventTask
2047            // so we do not need to create a new object just for pass some data
2048            const taskData = {};
2049            const nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER];
2050            const nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] =
2051                proto[REMOVE_EVENT_LISTENER];
2052            const nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] =
2053                proto[LISTENERS_EVENT_LISTENER];
2054            const nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] =
2055                proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER];
2056            let nativePrependEventListener;
2057            if (patchOptions && patchOptions.prepend) {
2058                nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] =
2059                    proto[patchOptions.prepend];
2060            }
2061            /**
2062             * This util function will build an option object with passive option
2063             * to handle all possible input from the user.
2064             */
2065            function buildEventListenerOptions(options, passive) {
2066                if (!passiveSupported && typeof options === 'object' && options) {
2067                    // doesn't support passive but user want to pass an object as options.
2068                    // this will not work on some old browser, so we just pass a boolean
2069                    // as useCapture parameter
2070                    return !!options.capture;
2071                }
2072                if (!passiveSupported || !passive) {
2073                    return options;
2074                }
2075                if (typeof options === 'boolean') {
2076                    return { capture: options, passive: true };
2077                }
2078                if (!options) {
2079                    return { passive: true };
2080                }
2081                if (typeof options === 'object' && options.passive !== false) {
2082                    return Object.assign(Object.assign({}, options), { passive: true });
2083                }
2084                return options;
2085            }
2086            const customScheduleGlobal = function (task) {
2087                // if there is already a task for the eventName + capture,
2088                // just return, because we use the shared globalZoneAwareCallback here.
2089                if (taskData.isExisting) {
2090                    return;
2091                }
2092                return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);
2093            };
2094            const customCancelGlobal = function (task) {
2095                // if task is not marked as isRemoved, this call is directly
2096                // from Zone.prototype.cancelTask, we should remove the task
2097                // from tasksList of target first
2098                if (!task.isRemoved) {
2099                    const symbolEventNames = zoneSymbolEventNames$1[task.eventName];
2100                    let symbolEventName;
2101                    if (symbolEventNames) {
2102                        symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR];
2103                    }
2104                    const existingTasks = symbolEventName && task.target[symbolEventName];
2105                    if (existingTasks) {
2106                        for (let i = 0; i < existingTasks.length; i++) {
2107                            const existingTask = existingTasks[i];
2108                            if (existingTask === task) {
2109                                existingTasks.splice(i, 1);
2110                                // set isRemoved to data for faster invokeTask check
2111                                task.isRemoved = true;
2112                                if (existingTasks.length === 0) {
2113                                    // all tasks for the eventName + capture have gone,
2114                                    // remove globalZoneAwareCallback and remove the task cache from target
2115                                    task.allRemoved = true;
2116                                    task.target[symbolEventName] = null;
2117                                }
2118                                break;
2119                            }
2120                        }
2121                    }
2122                }
2123                // if all tasks for the eventName + capture have gone,
2124                // we will really remove the global event callback,
2125                // if not, return
2126                if (!task.allRemoved) {
2127                    return;
2128                }
2129                return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);
2130            };
2131            const customScheduleNonGlobal = function (task) {
2132                return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
2133            };
2134            const customSchedulePrepend = function (task) {
2135                return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
2136            };
2137            const customCancelNonGlobal = function (task) {
2138                return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options);
2139            };
2140            const customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal;
2141            const customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal;
2142            const compareTaskCallbackVsDelegate = function (task, delegate) {
2143                const typeOfDelegate = typeof delegate;
2144                return (typeOfDelegate === 'function' && task.callback === delegate) ||
2145                    (typeOfDelegate === 'object' && task.originalDelegate === delegate);
2146            };
2147            const compare = (patchOptions && patchOptions.diff) ? patchOptions.diff : compareTaskCallbackVsDelegate;
2148            const blackListedEvents = Zone[zoneSymbol('BLACK_LISTED_EVENTS')];
2149            const passiveEvents = _global[zoneSymbol('PASSIVE_EVENTS')];
2150            const makeAddListener = function (nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget = false, prepend = false) {
2151                return function () {
2152                    const target = this || _global;
2153                    let eventName = arguments[0];
2154                    if (patchOptions && patchOptions.transferEventName) {
2155                        eventName = patchOptions.transferEventName(eventName);
2156                    }
2157                    let delegate = arguments[1];
2158                    if (!delegate) {
2159                        return nativeListener.apply(this, arguments);
2160                    }
2161                    if (isNode && eventName === 'uncaughtException') {
2162                        // don't patch uncaughtException of nodejs to prevent endless loop
2163                        return nativeListener.apply(this, arguments);
2164                    }
2165                    // don't create the bind delegate function for handleEvent
2166                    // case here to improve addEventListener performance
2167                    // we will create the bind delegate when invoke
2168                    let isHandleEvent = false;
2169                    if (typeof delegate !== 'function') {
2170                        if (!delegate.handleEvent) {
2171                            return nativeListener.apply(this, arguments);
2172                        }
2173                        isHandleEvent = true;
2174                    }
2175                    if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {
2176                        return;
2177                    }
2178                    const passive = passiveSupported && !!passiveEvents && passiveEvents.indexOf(eventName) !== -1;
2179                    const options = buildEventListenerOptions(arguments[2], passive);
2180                    if (blackListedEvents) {
2181                        // check black list
2182                        for (let i = 0; i < blackListedEvents.length; i++) {
2183                            if (eventName === blackListedEvents[i]) {
2184                                if (passive) {
2185                                    return nativeListener.call(target, eventName, delegate, options);
2186                                }
2187                                else {
2188                                    return nativeListener.apply(this, arguments);
2189                                }
2190                            }
2191                        }
2192                    }
2193                    const capture = !options ? false : typeof options === 'boolean' ? true : options.capture;
2194                    const once = options && typeof options === 'object' ? options.once : false;
2195                    const zone = Zone.current;
2196                    let symbolEventNames = zoneSymbolEventNames$1[eventName];
2197                    if (!symbolEventNames) {
2198                        prepareEventNames(eventName, eventNameToString);
2199                        symbolEventNames = zoneSymbolEventNames$1[eventName];
2200                    }
2201                    const symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];
2202                    let existingTasks = target[symbolEventName];
2203                    let isExisting = false;
2204                    if (existingTasks) {
2205                        // already have task registered
2206                        isExisting = true;
2207                        if (checkDuplicate) {
2208                            for (let i = 0; i < existingTasks.length; i++) {
2209                                if (compare(existingTasks[i], delegate)) {
2210                                    // same callback, same capture, same event name, just return
2211                                    return;
2212                                }
2213                            }
2214                        }
2215                    }
2216                    else {
2217                        existingTasks = target[symbolEventName] = [];
2218                    }
2219                    let source;
2220                    const constructorName = target.constructor['name'];
2221                    const targetSource = globalSources[constructorName];
2222                    if (targetSource) {
2223                        source = targetSource[eventName];
2224                    }
2225                    if (!source) {
2226                        source = constructorName + addSource +
2227                            (eventNameToString ? eventNameToString(eventName) : eventName);
2228                    }
2229                    // do not create a new object as task.data to pass those things
2230                    // just use the global shared one
2231                    taskData.options = options;
2232                    if (once) {
2233                        // if addEventListener with once options, we don't pass it to
2234                        // native addEventListener, instead we keep the once setting
2235                        // and handle ourselves.
2236                        taskData.options.once = false;
2237                    }
2238                    taskData.target = target;
2239                    taskData.capture = capture;
2240                    taskData.eventName = eventName;
2241                    taskData.isExisting = isExisting;
2242                    const data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined;
2243                    // keep taskData into data to allow onScheduleEventTask to access the task information
2244                    if (data) {
2245                        data.taskData = taskData;
2246                    }
2247                    const task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn);
2248                    // should clear taskData.target to avoid memory leak
2249                    // issue, https://github.com/angular/angular/issues/20442
2250                    taskData.target = null;
2251                    // need to clear up taskData because it is a global object
2252                    if (data) {
2253                        data.taskData = null;
2254                    }
2255                    // have to save those information to task in case
2256                    // application may call task.zone.cancelTask() directly
2257                    if (once) {
2258                        options.once = true;
2259                    }
2260                    if (!(!passiveSupported && typeof task.options === 'boolean')) {
2261                        // if not support passive, and we pass an option object
2262                        // to addEventListener, we should save the options to task
2263                        task.options = options;
2264                    }
2265                    task.target = target;
2266                    task.capture = capture;
2267                    task.eventName = eventName;
2268                    if (isHandleEvent) {
2269                        // save original delegate for compare to check duplicate
2270                        task.originalDelegate = delegate;
2271                    }
2272                    if (!prepend) {
2273                        existingTasks.push(task);
2274                    }
2275                    else {
2276                        existingTasks.unshift(task);
2277                    }
2278                    if (returnTarget) {
2279                        return target;
2280                    }
2281                };
2282            };
2283            proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget);
2284            if (nativePrependEventListener) {
2285                proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true);
2286            }
2287            proto[REMOVE_EVENT_LISTENER] = function () {
2288                const target = this || _global;
2289                let eventName = arguments[0];
2290                if (patchOptions && patchOptions.transferEventName) {
2291                    eventName = patchOptions.transferEventName(eventName);
2292                }
2293                const options = arguments[2];
2294                const capture = !options ? false : typeof options === 'boolean' ? true : options.capture;
2295                const delegate = arguments[1];
2296                if (!delegate) {
2297                    return nativeRemoveEventListener.apply(this, arguments);
2298                }
2299                if (validateHandler &&
2300                    !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) {
2301                    return;
2302                }
2303                const symbolEventNames = zoneSymbolEventNames$1[eventName];
2304                let symbolEventName;
2305                if (symbolEventNames) {
2306                    symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];
2307                }
2308                const existingTasks = symbolEventName && target[symbolEventName];
2309                if (existingTasks) {
2310                    for (let i = 0; i < existingTasks.length; i++) {
2311                        const existingTask = existingTasks[i];
2312                        if (compare(existingTask, delegate)) {
2313                            existingTasks.splice(i, 1);
2314                            // set isRemoved to data for faster invokeTask check
2315                            existingTask.isRemoved = true;
2316                            if (existingTasks.length === 0) {
2317                                // all tasks for the eventName + capture have gone,
2318                                // remove globalZoneAwareCallback and remove the task cache from target
2319                                existingTask.allRemoved = true;
2320                                target[symbolEventName] = null;
2321                                // in the target, we have an event listener which is added by on_property
2322                                // such as target.onclick = function() {}, so we need to clear this internal
2323                                // property too if all delegates all removed
2324                                if (typeof eventName === 'string') {
2325                                    const onPropertySymbol = ZONE_SYMBOL_PREFIX + 'ON_PROPERTY' + eventName;
2326                                    target[onPropertySymbol] = null;
2327                                }
2328                            }
2329                            existingTask.zone.cancelTask(existingTask);
2330                            if (returnTarget) {
2331                                return target;
2332                            }
2333                            return;
2334                        }
2335                    }
2336                }
2337                // issue 930, didn't find the event name or callback
2338                // from zone kept existingTasks, the callback maybe
2339                // added outside of zone, we need to call native removeEventListener
2340                // to try to remove it.
2341                return nativeRemoveEventListener.apply(this, arguments);
2342            };
2343            proto[LISTENERS_EVENT_LISTENER] = function () {
2344                const target = this || _global;
2345                let eventName = arguments[0];
2346                if (patchOptions && patchOptions.transferEventName) {
2347                    eventName = patchOptions.transferEventName(eventName);
2348                }
2349                const listeners = [];
2350                const tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);
2351                for (let i = 0; i < tasks.length; i++) {
2352                    const task = tasks[i];
2353                    let delegate = task.originalDelegate ? task.originalDelegate : task.callback;
2354                    listeners.push(delegate);
2355                }
2356                return listeners;
2357            };
2358            proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function () {
2359                const target = this || _global;
2360                let eventName = arguments[0];
2361                if (!eventName) {
2362                    const keys = Object.keys(target);
2363                    for (let i = 0; i < keys.length; i++) {
2364                        const prop = keys[i];
2365                        const match = EVENT_NAME_SYMBOL_REGX.exec(prop);
2366                        let evtName = match && match[1];
2367                        // in nodejs EventEmitter, removeListener event is
2368                        // used for monitoring the removeListener call,
2369                        // so just keep removeListener eventListener until
2370                        // all other eventListeners are removed
2371                        if (evtName && evtName !== 'removeListener') {
2372                            this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName);
2373                        }
2374                    }
2375                    // remove removeListener listener finally
2376                    this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, 'removeListener');
2377                }
2378                else {
2379                    if (patchOptions && patchOptions.transferEventName) {
2380                        eventName = patchOptions.transferEventName(eventName);
2381                    }
2382                    const symbolEventNames = zoneSymbolEventNames$1[eventName];
2383                    if (symbolEventNames) {
2384                        const symbolEventName = symbolEventNames[FALSE_STR];
2385                        const symbolCaptureEventName = symbolEventNames[TRUE_STR];
2386                        const tasks = target[symbolEventName];
2387                        const captureTasks = target[symbolCaptureEventName];
2388                        if (tasks) {
2389                            const removeTasks = tasks.slice();
2390                            for (let i = 0; i < removeTasks.length; i++) {
2391                                const task = removeTasks[i];
2392                                let delegate = task.originalDelegate ? task.originalDelegate : task.callback;
2393                                this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);
2394                            }
2395                        }
2396                        if (captureTasks) {
2397                            const removeTasks = captureTasks.slice();
2398                            for (let i = 0; i < removeTasks.length; i++) {
2399                                const task = removeTasks[i];
2400                                let delegate = task.originalDelegate ? task.originalDelegate : task.callback;
2401                                this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);
2402                            }
2403                        }
2404                    }
2405                }
2406                if (returnTarget) {
2407                    return this;
2408                }
2409            };
2410            // for native toString patch
2411            attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener);
2412            attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener);
2413            if (nativeRemoveAllListeners) {
2414                attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners);
2415            }
2416            if (nativeListeners) {
2417                attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners);
2418            }
2419            return true;
2420        }
2421        let results = [];
2422        for (let i = 0; i < apis.length; i++) {
2423            results[i] = patchEventTargetMethods(apis[i], patchOptions);
2424        }
2425        return results;
2426    }
2427    function findEventTasks(target, eventName) {
2428        if (!eventName) {
2429            const foundTasks = [];
2430            for (let prop in target) {
2431                const match = EVENT_NAME_SYMBOL_REGX.exec(prop);
2432                let evtName = match && match[1];
2433                if (evtName && (!eventName || evtName === eventName)) {
2434                    const tasks = target[prop];
2435                    if (tasks) {
2436                        for (let i = 0; i < tasks.length; i++) {
2437                            foundTasks.push(tasks[i]);
2438                        }
2439                    }
2440                }
2441            }
2442            return foundTasks;
2443        }
2444        let symbolEventName = zoneSymbolEventNames$1[eventName];
2445        if (!symbolEventName) {
2446            prepareEventNames(eventName);
2447            symbolEventName = zoneSymbolEventNames$1[eventName];
2448        }
2449        const captureFalseTasks = target[symbolEventName[FALSE_STR]];
2450        const captureTrueTasks = target[symbolEventName[TRUE_STR]];
2451        if (!captureFalseTasks) {
2452            return captureTrueTasks ? captureTrueTasks.slice() : [];
2453        }
2454        else {
2455            return captureTrueTasks ? captureFalseTasks.concat(captureTrueTasks) :
2456                captureFalseTasks.slice();
2457        }
2458    }
2459    function patchEventPrototype(global, api) {
2460        const Event = global['Event'];
2461        if (Event && Event.prototype) {
2462            api.patchMethod(Event.prototype, 'stopImmediatePropagation', (delegate) => function (self, args) {
2463                self[IMMEDIATE_PROPAGATION_SYMBOL] = true;
2464                // we need to call the native stopImmediatePropagation
2465                // in case in some hybrid application, some part of
2466                // application will be controlled by zone, some are not
2467                delegate && delegate.apply(self, args);
2468            });
2469        }
2470    }
2471
2472    /**
2473     * @license
2474     * Copyright Google Inc. All Rights Reserved.
2475     *
2476     * Use of this source code is governed by an MIT-style license that can be
2477     * found in the LICENSE file at https://angular.io/license
2478     */
2479    function patchCallbacks(api, target, targetName, method, callbacks) {
2480        const symbol = Zone.__symbol__(method);
2481        if (target[symbol]) {
2482            return;
2483        }
2484        const nativeDelegate = target[symbol] = target[method];
2485        target[method] = function (name, opts, options) {
2486            if (opts && opts.prototype) {
2487                callbacks.forEach(function (callback) {
2488                    const source = `${targetName}.${method}::` + callback;
2489                    const prototype = opts.prototype;
2490                    if (prototype.hasOwnProperty(callback)) {
2491                        const descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback);
2492                        if (descriptor && descriptor.value) {
2493                            descriptor.value = api.wrapWithCurrentZone(descriptor.value, source);
2494                            api._redefineProperty(opts.prototype, callback, descriptor);
2495                        }
2496                        else if (prototype[callback]) {
2497                            prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);
2498                        }
2499                    }
2500                    else if (prototype[callback]) {
2501                        prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);
2502                    }
2503                });
2504            }
2505            return nativeDelegate.call(target, name, opts, options);
2506        };
2507        api.attachOriginToPatched(target[method], nativeDelegate);
2508    }
2509
2510    /**
2511     * @license
2512     * Copyright Google Inc. All Rights Reserved.
2513     *
2514     * Use of this source code is governed by an MIT-style license that can be
2515     * found in the LICENSE file at https://angular.io/license
2516     */
2517    const globalEventHandlersEventNames = [
2518        'abort',
2519        'animationcancel',
2520        'animationend',
2521        'animationiteration',
2522        'auxclick',
2523        'beforeinput',
2524        'blur',
2525        'cancel',
2526        'canplay',
2527        'canplaythrough',
2528        'change',
2529        'compositionstart',
2530        'compositionupdate',
2531        'compositionend',
2532        'cuechange',
2533        'click',
2534        'close',
2535        'contextmenu',
2536        'curechange',
2537        'dblclick',
2538        'drag',
2539        'dragend',
2540        'dragenter',
2541        'dragexit',
2542        'dragleave',
2543        'dragover',
2544        'drop',
2545        'durationchange',
2546        'emptied',
2547        'ended',
2548        'error',
2549        'focus',
2550        'focusin',
2551        'focusout',
2552        'gotpointercapture',
2553        'input',
2554        'invalid',
2555        'keydown',
2556        'keypress',
2557        'keyup',
2558        'load',
2559        'loadstart',
2560        'loadeddata',
2561        'loadedmetadata',
2562        'lostpointercapture',
2563        'mousedown',
2564        'mouseenter',
2565        'mouseleave',
2566        'mousemove',
2567        'mouseout',
2568        'mouseover',
2569        'mouseup',
2570        'mousewheel',
2571        'orientationchange',
2572        'pause',
2573        'play',
2574        'playing',
2575        'pointercancel',
2576        'pointerdown',
2577        'pointerenter',
2578        'pointerleave',
2579        'pointerlockchange',
2580        'mozpointerlockchange',
2581        'webkitpointerlockerchange',
2582        'pointerlockerror',
2583        'mozpointerlockerror',
2584        'webkitpointerlockerror',
2585        'pointermove',
2586        'pointout',
2587        'pointerover',
2588        'pointerup',
2589        'progress',
2590        'ratechange',
2591        'reset',
2592        'resize',
2593        'scroll',
2594        'seeked',
2595        'seeking',
2596        'select',
2597        'selectionchange',
2598        'selectstart',
2599        'show',
2600        'sort',
2601        'stalled',
2602        'submit',
2603        'suspend',
2604        'timeupdate',
2605        'volumechange',
2606        'touchcancel',
2607        'touchmove',
2608        'touchstart',
2609        'touchend',
2610        'transitioncancel',
2611        'transitionend',
2612        'waiting',
2613        'wheel'
2614    ];
2615    const documentEventNames = [
2616        'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange',
2617        'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',
2618        'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',
2619        'visibilitychange', 'resume'
2620    ];
2621    const windowEventNames = [
2622        'absolutedeviceorientation',
2623        'afterinput',
2624        'afterprint',
2625        'appinstalled',
2626        'beforeinstallprompt',
2627        'beforeprint',
2628        'beforeunload',
2629        'devicelight',
2630        'devicemotion',
2631        'deviceorientation',
2632        'deviceorientationabsolute',
2633        'deviceproximity',
2634        'hashchange',
2635        'languagechange',
2636        'message',
2637        'mozbeforepaint',
2638        'offline',
2639        'online',
2640        'paint',
2641        'pageshow',
2642        'pagehide',
2643        'popstate',
2644        'rejectionhandled',
2645        'storage',
2646        'unhandledrejection',
2647        'unload',
2648        'userproximity',
2649        'vrdisplayconnected',
2650        'vrdisplaydisconnected',
2651        'vrdisplaypresentchange'
2652    ];
2653    const htmlElementEventNames = [
2654        'beforecopy', 'beforecut', 'beforepaste', 'copy', 'cut', 'paste', 'dragstart', 'loadend',
2655        'animationstart', 'search', 'transitionrun', 'transitionstart', 'webkitanimationend',
2656        'webkitanimationiteration', 'webkitanimationstart', 'webkittransitionend'
2657    ];
2658    const mediaElementEventNames = ['encrypted', 'waitingforkey', 'msneedkey', 'mozinterruptbegin', 'mozinterruptend'];
2659    const ieElementEventNames = [
2660        'activate',
2661        'afterupdate',
2662        'ariarequest',
2663        'beforeactivate',
2664        'beforedeactivate',
2665        'beforeeditfocus',
2666        'beforeupdate',
2667        'cellchange',
2668        'controlselect',
2669        'dataavailable',
2670        'datasetchanged',
2671        'datasetcomplete',
2672        'errorupdate',
2673        'filterchange',
2674        'layoutcomplete',
2675        'losecapture',
2676        'move',
2677        'moveend',
2678        'movestart',
2679        'propertychange',
2680        'resizeend',
2681        'resizestart',
2682        'rowenter',
2683        'rowexit',
2684        'rowsdelete',
2685        'rowsinserted',
2686        'command',
2687        'compassneedscalibration',
2688        'deactivate',
2689        'help',
2690        'mscontentzoom',
2691        'msmanipulationstatechanged',
2692        'msgesturechange',
2693        'msgesturedoubletap',
2694        'msgestureend',
2695        'msgesturehold',
2696        'msgesturestart',
2697        'msgesturetap',
2698        'msgotpointercapture',
2699        'msinertiastart',
2700        'mslostpointercapture',
2701        'mspointercancel',
2702        'mspointerdown',
2703        'mspointerenter',
2704        'mspointerhover',
2705        'mspointerleave',
2706        'mspointermove',
2707        'mspointerout',
2708        'mspointerover',
2709        'mspointerup',
2710        'pointerout',
2711        'mssitemodejumplistitemremoved',
2712        'msthumbnailclick',
2713        'stop',
2714        'storagecommit'
2715    ];
2716    const webglEventNames = ['webglcontextrestored', 'webglcontextlost', 'webglcontextcreationerror'];
2717    const formEventNames = ['autocomplete', 'autocompleteerror'];
2718    const detailEventNames = ['toggle'];
2719    const frameEventNames = ['load'];
2720    const frameSetEventNames = ['blur', 'error', 'focus', 'load', 'resize', 'scroll', 'messageerror'];
2721    const marqueeEventNames = ['bounce', 'finish', 'start'];
2722    const XMLHttpRequestEventNames = [
2723        'loadstart', 'progress', 'abort', 'error', 'load', 'progress', 'timeout', 'loadend',
2724        'readystatechange'
2725    ];
2726    const IDBIndexEventNames = ['upgradeneeded', 'complete', 'abort', 'success', 'error', 'blocked', 'versionchange', 'close'];
2727    const websocketEventNames = ['close', 'error', 'open', 'message'];
2728    const workerEventNames = ['error', 'message'];
2729    const eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);
2730    function filterProperties(target, onProperties, ignoreProperties) {
2731        if (!ignoreProperties || ignoreProperties.length === 0) {
2732            return onProperties;
2733        }
2734        const tip = ignoreProperties.filter(ip => ip.target === target);
2735        if (!tip || tip.length === 0) {
2736            return onProperties;
2737        }
2738        const targetIgnoreProperties = tip[0].ignoreProperties;
2739        return onProperties.filter(op => targetIgnoreProperties.indexOf(op) === -1);
2740    }
2741    function patchFilteredProperties(target, onProperties, ignoreProperties, prototype) {
2742        // check whether target is available, sometimes target will be undefined
2743        // because different browser or some 3rd party plugin.
2744        if (!target) {
2745            return;
2746        }
2747        const filteredProperties = filterProperties(target, onProperties, ignoreProperties);
2748        patchOnProperties(target, filteredProperties, prototype);
2749    }
2750    function propertyDescriptorPatch(api, _global) {
2751        if (isNode && !isMix) {
2752            return;
2753        }
2754        if (Zone[api.symbol('patchEvents')]) {
2755            // events are already been patched by legacy patch.
2756            return;
2757        }
2758        const supportsWebSocket = typeof WebSocket !== 'undefined';
2759        const ignoreProperties = _global['__Zone_ignore_on_properties'];
2760        // for browsers that we can patch the descriptor:  Chrome & Firefox
2761        if (isBrowser) {
2762            const internalWindow = window;
2763            const ignoreErrorProperties = isIE ? [{ target: internalWindow, ignoreProperties: ['error'] }] : [];
2764            // in IE/Edge, onProp not exist in window object, but in WindowPrototype
2765            // so we need to pass WindowPrototype to check onProp exist or not
2766            patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));
2767            patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);
2768            if (typeof internalWindow['SVGElement'] !== 'undefined') {
2769                patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);
2770            }
2771            patchFilteredProperties(Element.prototype, eventNames, ignoreProperties);
2772            patchFilteredProperties(HTMLElement.prototype, eventNames, ignoreProperties);
2773            patchFilteredProperties(HTMLMediaElement.prototype, mediaElementEventNames, ignoreProperties);
2774            patchFilteredProperties(HTMLFrameSetElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);
2775            patchFilteredProperties(HTMLBodyElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);
2776            patchFilteredProperties(HTMLFrameElement.prototype, frameEventNames, ignoreProperties);
2777            patchFilteredProperties(HTMLIFrameElement.prototype, frameEventNames, ignoreProperties);
2778            const HTMLMarqueeElement = internalWindow['HTMLMarqueeElement'];
2779            if (HTMLMarqueeElement) {
2780                patchFilteredProperties(HTMLMarqueeElement.prototype, marqueeEventNames, ignoreProperties);
2781            }
2782            const Worker = internalWindow['Worker'];
2783            if (Worker) {
2784                patchFilteredProperties(Worker.prototype, workerEventNames, ignoreProperties);
2785            }
2786        }
2787        const XMLHttpRequest = _global['XMLHttpRequest'];
2788        if (XMLHttpRequest) {
2789            // XMLHttpRequest is not available in ServiceWorker, so we need to check here
2790            patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);
2791        }
2792        const XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget'];
2793        if (XMLHttpRequestEventTarget) {
2794            patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties);
2795        }
2796        if (typeof IDBIndex !== 'undefined') {
2797            patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);
2798            patchFilteredProperties(IDBRequest.prototype, IDBIndexEventNames, ignoreProperties);
2799            patchFilteredProperties(IDBOpenDBRequest.prototype, IDBIndexEventNames, ignoreProperties);
2800            patchFilteredProperties(IDBDatabase.prototype, IDBIndexEventNames, ignoreProperties);
2801            patchFilteredProperties(IDBTransaction.prototype, IDBIndexEventNames, ignoreProperties);
2802            patchFilteredProperties(IDBCursor.prototype, IDBIndexEventNames, ignoreProperties);
2803        }
2804        if (supportsWebSocket) {
2805            patchFilteredProperties(WebSocket.prototype, websocketEventNames, ignoreProperties);
2806        }
2807    }
2808
2809    /**
2810     * @license
2811     * Copyright Google Inc. All Rights Reserved.
2812     *
2813     * Use of this source code is governed by an MIT-style license that can be
2814     * found in the LICENSE file at https://angular.io/license
2815     */
2816    Zone.__load_patch('util', (global, Zone, api) => {
2817        api.patchOnProperties = patchOnProperties;
2818        api.patchMethod = patchMethod;
2819        api.bindArguments = bindArguments;
2820        api.patchMacroTask = patchMacroTask;
2821        // In earlier version of zone.js (<0.9.0), we use env name `__zone_symbol__BLACK_LISTED_EVENTS` to
2822        // define which events will not be patched by `Zone.js`.
2823        // In newer version (>=0.9.0), we change the env name to `__zone_symbol__UNPATCHED_EVENTS` to keep
2824        // the name consistent with angular repo.
2825        // The  `__zone_symbol__BLACK_LISTED_EVENTS` is deprecated, but it is still be supported for
2826        // backwards compatibility.
2827        const SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS');
2828        const SYMBOL_UNPATCHED_EVENTS = Zone.__symbol__('UNPATCHED_EVENTS');
2829        if (global[SYMBOL_UNPATCHED_EVENTS]) {
2830            global[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_UNPATCHED_EVENTS];
2831        }
2832        if (global[SYMBOL_BLACK_LISTED_EVENTS]) {
2833            Zone[SYMBOL_BLACK_LISTED_EVENTS] = Zone[SYMBOL_UNPATCHED_EVENTS] =
2834                global[SYMBOL_BLACK_LISTED_EVENTS];
2835        }
2836        api.patchEventPrototype = patchEventPrototype;
2837        api.patchEventTarget = patchEventTarget;
2838        api.isIEOrEdge = isIEOrEdge;
2839        api.ObjectDefineProperty = ObjectDefineProperty;
2840        api.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor;
2841        api.ObjectCreate = ObjectCreate;
2842        api.ArraySlice = ArraySlice;
2843        api.patchClass = patchClass;
2844        api.wrapWithCurrentZone = wrapWithCurrentZone;
2845        api.filterProperties = filterProperties;
2846        api.attachOriginToPatched = attachOriginToPatched;
2847        api._redefineProperty = Object.defineProperty;
2848        api.patchCallbacks = patchCallbacks;
2849        api.getGlobalObjects = () => ({ globalSources, zoneSymbolEventNames: zoneSymbolEventNames$1, eventNames, isBrowser, isMix, isNode, TRUE_STR,
2850            FALSE_STR, ZONE_SYMBOL_PREFIX, ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR });
2851    });
2852
2853    /**
2854     * @license
2855     * Copyright Google Inc. All Rights Reserved.
2856     *
2857     * Use of this source code is governed by an MIT-style license that can be
2858     * found in the LICENSE file at https://angular.io/license
2859     */
2860    const taskSymbol = zoneSymbol('zoneTask');
2861    function patchTimer(window, setName, cancelName, nameSuffix) {
2862        let setNative = null;
2863        let clearNative = null;
2864        setName += nameSuffix;
2865        cancelName += nameSuffix;
2866        const tasksByHandleId = {};
2867        function scheduleTask(task) {
2868            const data = task.data;
2869            function timer() {
2870                try {
2871                    task.invoke.apply(this, arguments);
2872                }
2873                finally {
2874                    // issue-934, task will be cancelled
2875                    // even it is a periodic task such as
2876                    // setInterval
2877                    if (!(task.data && task.data.isPeriodic)) {
2878                        if (typeof data.handleId === 'number') {
2879                            // in non-nodejs env, we remove timerId
2880                            // from local cache
2881                            delete tasksByHandleId[data.handleId];
2882                        }
2883                        else if (data.handleId) {
2884                            // Node returns complex objects as handleIds
2885                            // we remove task reference from timer object
2886                            data.handleId[taskSymbol] = null;
2887                        }
2888                    }
2889                }
2890            }
2891            data.args[0] = timer;
2892            data.handleId = setNative.apply(window, data.args);
2893            return task;
2894        }
2895        function clearTask(task) { return clearNative(task.data.handleId); }
2896        setNative =
2897            patchMethod(window, setName, (delegate) => function (self, args) {
2898                if (typeof args[0] === 'function') {
2899                    const options = {
2900                        isPeriodic: nameSuffix === 'Interval',
2901                        delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 :
2902                            undefined,
2903                        args: args
2904                    };
2905                    const task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
2906                    if (!task) {
2907                        return task;
2908                    }
2909                    // Node.js must additionally support the ref and unref functions.
2910                    const handle = task.data.handleId;
2911                    if (typeof handle === 'number') {
2912                        // for non nodejs env, we save handleId: task
2913                        // mapping in local cache for clearTimeout
2914                        tasksByHandleId[handle] = task;
2915                    }
2916                    else if (handle) {
2917                        // for nodejs env, we save task
2918                        // reference in timerId Object for clearTimeout
2919                        handle[taskSymbol] = task;
2920                    }
2921                    // check whether handle is null, because some polyfill or browser
2922                    // may return undefined from setTimeout/setInterval/setImmediate/requestAnimationFrame
2923                    if (handle && handle.ref && handle.unref && typeof handle.ref === 'function' &&
2924                        typeof handle.unref === 'function') {
2925                        task.ref = handle.ref.bind(handle);
2926                        task.unref = handle.unref.bind(handle);
2927                    }
2928                    if (typeof handle === 'number' || handle) {
2929                        return handle;
2930                    }
2931                    return task;
2932                }
2933                else {
2934                    // cause an error by calling it directly.
2935                    return delegate.apply(window, args);
2936                }
2937            });
2938        clearNative =
2939            patchMethod(window, cancelName, (delegate) => function (self, args) {
2940                const id = args[0];
2941                let task;
2942                if (typeof id === 'number') {
2943                    // non nodejs env.
2944                    task = tasksByHandleId[id];
2945                }
2946                else {
2947                    // nodejs env.
2948                    task = id && id[taskSymbol];
2949                    // other environments.
2950                    if (!task) {
2951                        task = id;
2952                    }
2953                }
2954                if (task && typeof task.type === 'string') {
2955                    if (task.state !== 'notScheduled' &&
2956                        (task.cancelFn && task.data.isPeriodic || task.runCount === 0)) {
2957                        if (typeof id === 'number') {
2958                            delete tasksByHandleId[id];
2959                        }
2960                        else if (id) {
2961                            id[taskSymbol] = null;
2962                        }
2963                        // Do not cancel already canceled functions
2964                        task.zone.cancelTask(task);
2965                    }
2966                }
2967                else {
2968                    // cause an error by calling it directly.
2969                    delegate.apply(window, args);
2970                }
2971            });
2972    }
2973
2974    /**
2975     * @license
2976     * Copyright Google Inc. All Rights Reserved.
2977     *
2978     * Use of this source code is governed by an MIT-style license that can be
2979     * found in the LICENSE file at https://angular.io/license
2980     */
2981    function patchCustomElements(_global, api) {
2982        const { isBrowser, isMix } = api.getGlobalObjects();
2983        if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) {
2984            return;
2985        }
2986        const callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];
2987        api.patchCallbacks(api, _global.customElements, 'customElements', 'define', callbacks);
2988    }
2989
2990    /**
2991     * @license
2992     * Copyright Google Inc. All Rights Reserved.
2993     *
2994     * Use of this source code is governed by an MIT-style license that can be
2995     * found in the LICENSE file at https://angular.io/license
2996     */
2997    function eventTargetPatch(_global, api) {
vendor: 4,520 bytes, lines 2998-3098
2998        if (Zone[api.symbol('patchEventTarget')]) {
2999            // EventTarget is already patched.
3000            return;
3001        }
3002        const { eventNames, zoneSymbolEventNames, TRUE_STR, FALSE_STR, ZONE_SYMBOL_PREFIX } = api.getGlobalObjects();
3003        //  predefine all __zone_symbol__ + eventName + true/false string
3004        for (let i = 0; i < eventNames.length; i++) {
3005            const eventName = eventNames[i];
3006            const falseEventName = eventName + FALSE_STR;
3007            const trueEventName = eventName + TRUE_STR;
3008            const symbol = ZONE_SYMBOL_PREFIX + falseEventName;
3009            const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
3010            zoneSymbolEventNames[eventName] = {};
3011            zoneSymbolEventNames[eventName][FALSE_STR] = symbol;
3012            zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;
3013        }
3014        const EVENT_TARGET = _global['EventTarget'];
3015        if (!EVENT_TARGET || !EVENT_TARGET.prototype) {
3016            return;
3017        }
3018        api.patchEventTarget(_global, [EVENT_TARGET && EVENT_TARGET.prototype]);
3019        return true;
3020    }
3021    function patchEvent(global, api) {
3022        api.patchEventPrototype(global, api);
3023    }
3024
3025    /**
3026     * @license
3027     * Copyright Google Inc. All Rights Reserved.
3028     *
3029     * Use of this source code is governed by an MIT-style license that can be
3030     * found in the LICENSE file at https://angular.io/license
3031     */
3032    Zone.__load_patch('legacy', (global) => {
3033        const legacyPatch = global[Zone.__symbol__('legacyPatch')];
3034        if (legacyPatch) {
3035            legacyPatch();
3036        }
3037    });
3038    Zone.__load_patch('timers', (global) => {
3039        const set = 'set';
3040        const clear = 'clear';
3041        patchTimer(global, set, clear, 'Timeout');
3042        patchTimer(global, set, clear, 'Interval');
3043        patchTimer(global, set, clear, 'Immediate');
3044    });
3045    Zone.__load_patch('requestAnimationFrame', (global) => {
3046        patchTimer(global, 'request', 'cancel', 'AnimationFrame');
3047        patchTimer(global, 'mozRequest', 'mozCancel', 'AnimationFrame');
3048        patchTimer(global, 'webkitRequest', 'webkitCancel', 'AnimationFrame');
3049    });
3050    Zone.__load_patch('blocking', (global, Zone) => {
3051        const blockingMethods = ['alert', 'prompt', 'confirm'];
3052        for (let i = 0; i < blockingMethods.length; i++) {
3053            const name = blockingMethods[i];
3054            patchMethod(global, name, (delegate, symbol, name) => {
3055                return function (s, args) {
3056                    return Zone.current.run(delegate, global, args, name);
3057                };
3058            });
3059        }
3060    });
3061    Zone.__load_patch('EventTarget', (global, Zone, api) => {
3062        patchEvent(global, api);
3063        eventTargetPatch(global, api);
3064        // patch XMLHttpRequestEventTarget's addEventListener/removeEventListener
3065        const XMLHttpRequestEventTarget = global['XMLHttpRequestEventTarget'];
3066        if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {
3067            api.patchEventTarget(global, [XMLHttpRequestEventTarget.prototype]);
3068        }
3069        patchClass('MutationObserver');
3070        patchClass('WebKitMutationObserver');
3071        patchClass('IntersectionObserver');
3072        patchClass('FileReader');
3073    });
3074    Zone.__load_patch('on_property', (global, Zone, api) => {
3075        propertyDescriptorPatch(api, global);
3076    });
3077    Zone.__load_patch('customElements', (global, Zone, api) => {
3078        patchCustomElements(global, api);
3079    });
3080    Zone.__load_patch('XHR', (global, Zone) => {
3081        // Treat XMLHttpRequest as a macrotask.
3082        patchXHR(global);
3083        const XHR_TASK = zoneSymbol('xhrTask');
3084        const XHR_SYNC = zoneSymbol('xhrSync');
3085        const XHR_LISTENER = zoneSymbol('xhrListener');
3086        const XHR_SCHEDULED = zoneSymbol('xhrScheduled');
3087        const XHR_URL = zoneSymbol('xhrURL');
3088        const XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');
3089        function patchXHR(window) {
3090            const XMLHttpRequest = window['XMLHttpRequest'];
3091            if (!XMLHttpRequest) {
3092                // XMLHttpRequest is not available in service worker
3093                return;
3094            }
3095            const XMLHttpRequestPrototype = XMLHttpRequest.prototype;
3096            function findPendingTask(target) { return target[XHR_TASK]; }
3097            let oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
3098            let oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_
3098EVENT_LISTENER];
3099            if (!oriAddListener) {
3100                const XMLHttpRequestEventTarget = window['XMLHttpRequestEventTarget'];
3101                if (XMLHttpRequestEventTarget) {
3102                    const XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;
3103                    oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
3104                    oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
3105                }
3106            }
3107            const READY_STATE_CHANGE = 'readystatechange';
3108            const SCHEDULED = 'scheduled';
3109            function scheduleTask(task) {
3110                const data = task.data;
3111                const target = data.target;
3112                target[XHR_SCHEDULED] = false;
3113                target[XHR_ERROR_BEFORE_SCHEDULED] = false;
3114                // remove existing event listener
3115                const listener = target[XHR_LISTENER];
3116                if (!oriAddListener) {
3117                    oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER];
3118                    oriRemoveListener = target[ZONE_SYMBOL_REMOVE_
vendor: 7,712 bytes, lines 3118-3265
3118EVENT_LISTENER];
3119                }
3120                if (listener) {
3121                    oriRemoveListener.call(target, READY_STATE_CHANGE, listener);
3122                }
3123                const newListener = target[XHR_LISTENER] = () => {
3124                    if (target.readyState === target.DONE) {
3125                        // sometimes on some browsers XMLHttpRequest will fire onreadystatechange with
3126                        // readyState=4 multiple times, so we need to check task state here
3127                        if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {
3128                            // check whether the xhr has registered onload listener
3129                            // if that is the case, the task should invoke after all
3130                            // onload listeners finish.
3131                            const loadTasks = target[Zone.__symbol__('loadfalse')];
3132                            if (loadTasks && loadTasks.length > 0) {
3133                                const oriInvoke = task.invoke;
3134                                task.invoke = function () {
3135                                    // need to load the tasks again, because in other
3136                                    // load listener, they may remove themselves
3137                                    const loadTasks = target[Zone.__symbol__('loadfalse')];
3138                                    for (let i = 0; i < loadTasks.length; i++) {
3139                                        if (loadTasks[i] === task) {
3140                                            loadTasks.splice(i, 1);
3141                                        }
3142                                    }
3143                                    if (!data.aborted && task.state === SCHEDULED) {
3144                                        oriInvoke.call(task);
3145                                    }
3146                                };
3147                                loadTasks.push(task);
3148                            }
3149                            else {
3150                                task.invoke();
3151                            }
3152                        }
3153                        else if (!data.aborted && target[XHR_SCHEDULED] === false) {
3154                            // error occurs when xhr.send()
3155                            target[XHR_ERROR_BEFORE_SCHEDULED] = true;
3156                        }
3157                    }
3158                };
3159                oriAddListener.call(target, READY_STATE_CHANGE, newListener);
3160                const storedTask = target[XHR_TASK];
3161                if (!storedTask) {
3162                    target[XHR_TASK] = task;
3163                }
3164                sendNative.apply(target, data.args);
3165                target[XHR_SCHEDULED] = true;
3166                return task;
3167            }
3168            function placeholderCallback() { }
3169            function clearTask(task) {
3170                const data = task.data;
3171                // Note - ideally, we would call data.target.removeEventListener here, but it's too late
3172                // to prevent it from firing. So instead, we store info for the event listener.
3173                data.aborted = true;
3174                return abortNative.apply(data.target, data.args);
3175            }
3176            const openNative = patchMethod(XMLHttpRequestPrototype, 'open', () => function (self, args) {
3177                self[XHR_SYNC] = args[2] == false;
3178                self[XHR_URL] = args[1];
3179                return openNative.apply(self, args);
3180            });
3181            const XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';
3182            const fetchTaskAborting = zoneSymbol('fetchTaskAborting');
3183            const fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');
3184            const sendNative = patchMethod(XMLHttpRequestPrototype, 'send', () => function (self, args) {
3185                if (Zone.current[fetchTaskScheduling] === true) {
3186                    // a fetch is scheduling, so we are using xhr to polyfill fetch
3187                    // and because we already schedule macroTask for fetch, we should
3188                    // not schedule a macroTask for xhr again
3189                    return sendNative.apply(self, args);
3190                }
3191                if (self[XHR_SYNC]) {
3192                    // if the XHR is sync there is no task to schedule, just execute the code.
3193                    return sendNative.apply(self, args);
3194                }
3195                else {
3196                    const options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false };
3197                    const task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
3198                    if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted &&
3199                        task.state === SCHEDULED) {
3200                        // xhr request throw error when send
3201                        // we should invoke task instead of leaving a scheduled
3202                        // pending macroTask
3203                        task.invoke();
3204                    }
3205                }
3206            });
3207            const abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', () => function (self, args) {
3208                const task = findPendingTask(self);
3209                if (task && typeof task.type == 'string') {
3210                    // If the XHR has already completed, do nothing.
3211                    // If the XHR has already been aborted, do nothing.
3212                    // Fix #569, call abort multiple times before done will cause
3213                    // macroTask task count be negative number
3214                    if (task.cancelFn == null || (task.data && task.data.aborted)) {
3215                        return;
3216                    }
3217                    task.zone.cancelTask(task);
3218                }
3219                else if (Zone.current[fetchTaskAborting] === true) {
3220                    // the abort is called from fetch polyfill, we need to call native abort of XHR.
3221                    return abortNative.apply(self, args);
3222                }
3223                // Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no
3224                // task
3225                // to cancel. Do nothing.
3226            });
3227        }
3228    });
3229    Zone.__load_patch('geolocation', (global) => {
3230        /// GEO_LOCATION
3231        if (global['navigator'] && global['navigator'].geolocation) {
3232            patchPrototype(global['navigator'].geolocation, ['getCurrentPosition', 'watchPosition']);
3233        }
3234    });
3235    Zone.__load_patch('PromiseRejectionEvent', (global, Zone) => {
3236        // handle unhandled promise rejection
3237        function findPromiseRejectionHandler(evtName) {
3238            return function (e) {
3239                const eventTasks = findEventTasks(global, evtName);
3240                eventTasks.forEach(eventTask => {
3241                    // windows has added unhandledrejection event listener
3242                    // trigger the event listener
3243                    const PromiseRejectionEvent = global['PromiseRejectionEvent'];
3244                    if (PromiseRejectionEvent) {
3245                        const evt = new PromiseRejectionEvent(evtName, { promise: e.promise, reason: e.rejection });
3246                        eventTask.invoke(evt);
3247                    }
3248                });
3249            };
3250        }
3251        if (global['PromiseRejectionEvent']) {
3252            Zone[zoneSymbol('unhandledPromiseRejectionHandler')] =
3253                findPromiseRejectionHandler('unhandledrejection');
3254            Zone[zoneSymbol('rejectionHandledHandler')] =
3255                findPromiseRejectionHandler('rejectionhandled');
3256        }
3257    });
3258
3259})));
3260
3261
3262/***/ })
3263
3264},[[2,"runtime"]]]);
3265//# sourceMappingURL=polyfills-es2015.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.