PageSourceSearch

https://efsa-prep.netlify.app/polyfills.68becf25d76b5942.js

js efsa-prep.netlify.app collected 2026-10-03 10:41:13 UTC 152,506 bytes, 3,702 lines download raw bytes

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