dealposbarcode 1.3.4 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,8 +70,8 @@ __webpack_require__.r(__webpack_exports__);
70
70
 
71
71
 
72
72
  /**
73
- * @license Angular v12.0.0-next.0
74
- * (c) 2010-2020 Google LLC. https://angular.io/
73
+ * @license Angular v14.1.0-next.0
74
+ * (c) 2010-2022 Google LLC. https://angular.io/
75
75
  * License: MIT
76
76
  */
77
77
 
@@ -83,7 +83,7 @@ __webpack_require__.r(__webpack_exports__);
83
83
  * found in the LICENSE file at https://angular.io/license
84
84
  */
85
85
 
86
- const Zone$1 = function (global) {
86
+ (function (global) {
87
87
  const performance = global['performance'];
88
88
 
89
89
  function mark(name) {
@@ -128,7 +128,7 @@ const Zone$1 = function (global) {
128
128
  this._parent = parent;
129
129
  this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
130
130
  this._properties = zoneSpec && zoneSpec.properties || {};
131
- this._zoneDelegate = new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);
131
+ this._zoneDelegate = new _ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);
132
132
  }
133
133
 
134
134
  static assertZonePatched() {
@@ -409,7 +409,7 @@ const Zone$1 = function (global) {
409
409
  onCancelTask: (delegate, _, target, task) => delegate.cancelTask(target, task)
410
410
  };
411
411
 
412
- class ZoneDelegate {
412
+ class _ZoneDelegate {
413
413
  constructor(zone, parentDelegate, zoneSpec) {
414
414
  this._taskCounts = {
415
415
  'microTask': 0,
@@ -680,30 +680,34 @@ const Zone$1 = function (global) {
680
680
  let _isDrainingMicrotaskQueue = false;
681
681
  let nativeMicroTaskQueuePromise;
682
682
 
683
+ function nativeScheduleMicroTask(func) {
684
+ if (!nativeMicroTaskQueuePromise) {
685
+ if (global[symbolPromise]) {
686
+ nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);
687
+ }
688
+ }
689
+
690
+ if (nativeMicroTaskQueuePromise) {
691
+ let nativeThen = nativeMicroTaskQueuePromise[symbolThen];
692
+
693
+ if (!nativeThen) {
694
+ // native Promise is not patchable, we need to use `then` directly
695
+ // issue 1078
696
+ nativeThen = nativeMicroTaskQueuePromise['then'];
697
+ }
698
+
699
+ nativeThen.call(nativeMicroTaskQueuePromise, func);
700
+ } else {
701
+ global[symbolSetTimeout](func, 0);
702
+ }
703
+ }
704
+
683
705
  function scheduleMicroTask(task) {
684
706
  // if we are not running in any task, and there has not been anything scheduled
685
707
  // we must bootstrap the initial task creation by manually scheduling the drain
686
708
  if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) {
687
709
  // We are not running in Task, so we need to kickstart the microtask queue.
688
- if (!nativeMicroTaskQueuePromise) {
689
- if (global[symbolPromise]) {
690
- nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);
691
- }
692
- }
693
-
694
- if (nativeMicroTaskQueuePromise) {
695
- let nativeThen = nativeMicroTaskQueuePromise[symbolThen];
696
-
697
- if (!nativeThen) {
698
- // native Promise is not patchable, we need to use `then` directly
699
- // issue 1078
700
- nativeThen = nativeMicroTaskQueuePromise['then'];
701
- }
702
-
703
- nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
704
- } else {
705
- global[symbolSetTimeout](drainMicroTaskQueue, 0);
706
- }
710
+ nativeScheduleMicroTask(drainMicroTaskQueue);
707
711
  }
708
712
 
709
713
  task && _microTaskQueue.push(task);
@@ -777,7 +781,8 @@ const Zone$1 = function (global) {
777
781
  filterProperties: () => [],
778
782
  attachOriginToPatched: () => noop,
779
783
  _redefineProperty: () => noop,
780
- patchCallbacks: () => noop
784
+ patchCallbacks: () => noop,
785
+ nativeScheduleMicroTask: nativeScheduleMicroTask
781
786
  };
782
787
  let _currentZoneFrame = {
783
788
  parent: null,
@@ -790,7 +795,7 @@ const Zone$1 = function (global) {
790
795
 
791
796
  performanceMeasure('Zone', 'Zone');
792
797
  return global['Zone'] = Zone;
793
- }(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
798
+ })(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
794
799
  /**
795
800
  * @license
796
801
  * Copyright Google LLC All Rights Reserved.
@@ -862,7 +867,6 @@ const internalWindow = isWindowExists ? window : undefined;
862
867
  const _global = isWindowExists && internalWindow || typeof self === 'object' && self || global;
863
868
 
864
869
  const REMOVE_ATTRIBUTE = 'removeAttribute';
865
- const NULL_ON_PROP_VALUE = [null];
866
870
 
867
871
  function bindArguments(args, source) {
868
872
  for (let i = args.length - 1; i >= 0; i--) {
@@ -921,7 +925,7 @@ const isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow
921
925
  // this code.
922
926
 
923
927
  const isMix = typeof _global.process !== 'undefined' && {}.toString.call(_global.process) === '[object process]' && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']);
924
- const zoneSymbolEventNames = {};
928
+ const zoneSymbolEventNames$1 = {};
925
929
 
926
930
  const wrapFn = function (event) {
927
931
  // https://github.com/angular/zone.js/issues/911, in IE, sometimes
@@ -932,10 +936,10 @@ const wrapFn = function (event) {
932
936
  return;
933
937
  }
934
938
 
935
- let eventNameSymbol = zoneSymbolEventNames[event.type];
939
+ let eventNameSymbol = zoneSymbolEventNames$1[event.type];
936
940
 
937
941
  if (!eventNameSymbol) {
938
- eventNameSymbol = zoneSymbolEventNames[event.type] = zoneSymbol('ON_PROPERTY' + event.type);
942
+ eventNameSymbol = zoneSymbolEventNames$1[event.type] = zoneSymbol('ON_PROPERTY' + event.type);
939
943
  }
940
944
 
941
945
  const target = this || event.target || _global;
@@ -998,13 +1002,13 @@ function patchProperty(obj, prop, prototype) {
998
1002
  delete desc.writable;
999
1003
  delete desc.value;
1000
1004
  const originalDescGet = desc.get;
1001
- const originalDescSet = desc.set; // substr(2) cuz 'onclick' -> 'click', etc
1005
+ const originalDescSet = desc.set; // slice(2) cuz 'onclick' -> 'click', etc
1002
1006
 
1003
- const eventName = prop.substr(2);
1004
- let eventNameSymbol = zoneSymbolEventNames[eventName];
1007
+ const eventName = prop.slice(2);
1008
+ let eventNameSymbol = zoneSymbolEventNames$1[eventName];
1005
1009
 
1006
1010
  if (!eventNameSymbol) {
1007
- eventNameSymbol = zoneSymbolEventNames[eventName] = zoneSymbol('ON_PROPERTY' + eventName);
1011
+ eventNameSymbol = zoneSymbolEventNames$1[eventName] = zoneSymbol('ON_PROPERTY' + eventName);
1008
1012
  }
1009
1013
 
1010
1014
  desc.set = function (newValue) {
@@ -1020,23 +1024,19 @@ function patchProperty(obj, prop, prototype) {
1020
1024
  return;
1021
1025
  }
1022
1026
 
1023
- let previousValue = target[eventNameSymbol];
1027
+ const previousValue = target[eventNameSymbol];
1024
1028
 
1025
- if (previousValue) {
1029
+ if (typeof previousValue === 'function') {
1026
1030
  target.removeEventListener(eventName, wrapFn);
1027
1031
  } // issue #978, when onload handler was added before loading zone.js
1028
1032
  // we should remove it with originalDescSet
1029
1033
 
1030
1034
 
1031
- if (originalDescSet) {
1032
- originalDescSet.apply(target, NULL_ON_PROP_VALUE);
1033
- }
1035
+ originalDescSet && originalDescSet.call(target, null);
1036
+ target[eventNameSymbol] = newValue;
1034
1037
 
1035
1038
  if (typeof newValue === 'function') {
1036
- target[eventNameSymbol] = newValue;
1037
1039
  target.addEventListener(eventName, wrapFn, false);
1038
- } else {
1039
- target[eventNameSymbol] = null;
1040
1040
  }
1041
1041
  }; // The getter would return undefined for unassigned properties but the default value of an
1042
1042
  // unassigned property is null
@@ -1066,7 +1066,7 @@ function patchProperty(obj, prop, prototype) {
1066
1066
  // the onclick will be evaluated when first time event was triggered or
1067
1067
  // the property is accessed, https://github.com/angular/zone.js/issues/525
1068
1068
  // so we should use original native get to retrieve the handler
1069
- let value = originalDescGet && originalDescGet.call(this);
1069
+ let value = originalDescGet.call(this);
1070
1070
 
1071
1071
  if (value) {
1072
1072
  desc.set.call(this, value);
@@ -1095,7 +1095,7 @@ function patchOnProperties(obj, properties, prototype) {
1095
1095
  const onProperties = [];
1096
1096
 
1097
1097
  for (const prop in obj) {
1098
- if (prop.substr(0, 2) == 'on') {
1098
+ if (prop.slice(0, 2) == 'on') {
1099
1099
  onProperties.push(prop);
1100
1100
  }
1101
1101
  }
@@ -1581,6 +1581,8 @@ Zone.__load_patch('ZoneAwarePromise', (global, Zone, api) => {
1581
1581
 
1582
1582
  const noop = function () {};
1583
1583
 
1584
+ const AggregateError = global.AggregateError;
1585
+
1584
1586
  class ZoneAwarePromise {
1585
1587
  static toString() {
1586
1588
  return ZONE_AWARE_PROMISE_TO_STRING;
@@ -1594,6 +1596,51 @@ Zone.__load_patch('ZoneAwarePromise', (global, Zone, api) => {
1594
1596
  return resolvePromise(new this(null), REJECTED, error);
1595
1597
  }
1596
1598
 
1599
+ static any(values) {
1600
+ if (!values || typeof values[Symbol.iterator] !== 'function') {
1601
+ return Promise.reject(new AggregateError([], 'All promises were rejected'));
1602
+ }
1603
+
1604
+ const promises = [];
1605
+ let count = 0;
1606
+
1607
+ try {
1608
+ for (let v of values) {
1609
+ count++;
1610
+ promises.push(ZoneAwarePromise.resolve(v));
1611
+ }
1612
+ } catch (err) {
1613
+ return Promise.reject(new AggregateError([], 'All promises were rejected'));
1614
+ }
1615
+
1616
+ if (count === 0) {
1617
+ return Promise.reject(new AggregateError([], 'All promises were rejected'));
1618
+ }
1619
+
1620
+ let finished = false;
1621
+ const errors = [];
1622
+ return new ZoneAwarePromise((resolve, reject) => {
1623
+ for (let i = 0; i < promises.length; i++) {
1624
+ promises[i].then(v => {
1625
+ if (finished) {
1626
+ return;
1627
+ }
1628
+
1629
+ finished = true;
1630
+ resolve(v);
1631
+ }, err => {
1632
+ errors.push(err);
1633
+ count--;
1634
+
1635
+ if (count === 0) {
1636
+ finished = true;
1637
+ reject(new AggregateError(errors, 'All promises were rejected'));
1638
+ }
1639
+ });
1640
+ }
1641
+ });
1642
+ }
1643
+
1597
1644
  static race(values) {
1598
1645
  let resolve;
1599
1646
  let reject;
@@ -1707,7 +1754,8 @@ Zone.__load_patch('ZoneAwarePromise', (global, Zone, api) => {
1707
1754
  promise[symbolValue] = []; // queue;
1708
1755
 
1709
1756
  try {
1710
- executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));
1757
+ const onceWrapper = once();
1758
+ executor && executor(onceWrapper(makeResolver(promise, RESOLVED)), onceWrapper(makeResolver(promise, REJECTED)));
1711
1759
  } catch (error) {
1712
1760
  resolvePromise(promise, false, error);
1713
1761
  }
@@ -1722,7 +1770,17 @@ Zone.__load_patch('ZoneAwarePromise', (global, Zone, api) => {
1722
1770
  }
1723
1771
 
1724
1772
  then(onFulfilled, onRejected) {
1725
- let C = this.constructor[Symbol.species];
1773
+ var _a; // We must read `Symbol.species` safely because `this` may be anything. For instance, `this`
1774
+ // may be an object without a prototype (created through `Object.create(null)`); thus
1775
+ // `this.constructor` will be undefined. One of the use cases is SystemJS creating
1776
+ // prototype-less objects (modules) via `Object.create(null)`. The SystemJS creates an empty
1777
+ // object and copies promise properties into that object (within the `getOrCreateLoad`
1778
+ // function). The zone.js then checks if the resolved value has the `then` method and invokes
1779
+ // it with the `value` context. Otherwise, this will throw an error: `TypeError: Cannot read
1780
+ // properties of undefined (reading 'Symbol(Symbol.species)')`.
1781
+
1782
+
1783
+ let C = (_a = this.constructor) === null || _a === void 0 ? void 0 : _a[Symbol.species];
1726
1784
 
1727
1785
  if (!C || typeof C !== 'function') {
1728
1786
  C = this.constructor || ZoneAwarePromise;
@@ -1745,7 +1803,10 @@ Zone.__load_patch('ZoneAwarePromise', (global, Zone, api) => {
1745
1803
  }
1746
1804
 
1747
1805
  finally(onFinally) {
1748
- let C = this.constructor[Symbol.species];
1806
+ var _a; // See comment on the call to `then` about why thee `Symbol.species` is safely accessed.
1807
+
1808
+
1809
+ let C = (_a = this.constructor) === null || _a === void 0 ? void 0 : _a[Symbol.species];
1749
1810
 
1750
1811
  if (!C || typeof C !== 'function') {
1751
1812
  C = ZoneAwarePromise;
@@ -1911,7 +1972,10 @@ if (typeof window !== 'undefined') {
1911
1972
  get: function () {
1912
1973
  passiveSupported = true;
1913
1974
  }
1914
- });
1975
+ }); // Note: We pass the `options` object as the event handler too. This is not compatible with the
1976
+ // signature of `addEventListener` or `removeEventListener` but enables us to remove the handler
1977
+ // without an actual handler.
1978
+
1915
1979
  window.addEventListener('test', options, options);
1916
1980
  window.removeEventListener('test', options, options);
1917
1981
  } catch (err) {
@@ -1923,7 +1987,7 @@ if (typeof window !== 'undefined') {
1923
1987
  const OPTIMIZED_ZONE_EVENT_TASK_DATA = {
1924
1988
  useG: true
1925
1989
  };
1926
- const zoneSymbolEventNames$1 = {};
1990
+ const zoneSymbolEventNames = {};
1927
1991
  const globalSources = {};
1928
1992
  const EVENT_NAME_SYMBOL_REGX = new RegExp('^' + ZONE_SYMBOL_PREFIX + '(\\w+)(true|false)$');
1929
1993
  const IMMEDIATE_PROPAGATION_SYMBOL = zoneSymbol('propagationStopped');
@@ -1933,12 +1997,12 @@ function prepareEventNames(eventName, eventNameToString) {
1933
1997
  const trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;
1934
1998
  const symbol = ZONE_SYMBOL_PREFIX + falseEventName;
1935
1999
  const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
1936
- zoneSymbolEventNames$1[eventName] = {};
1937
- zoneSymbolEventNames$1[eventName][FALSE_STR] = symbol;
1938
- zoneSymbolEventNames$1[eventName][TRUE_STR] = symbolCapture;
2000
+ zoneSymbolEventNames[eventName] = {};
2001
+ zoneSymbolEventNames[eventName][FALSE_STR] = symbol;
2002
+ zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;
1939
2003
  }
1940
2004
 
1941
- function patchEventTarget(_global, apis, patchOptions) {
2005
+ function patchEventTarget(_global, api, apis, patchOptions) {
1942
2006
  const ADD_EVENT_LISTENER = patchOptions && patchOptions.add || ADD_EVENT_LISTENER_STR;
1943
2007
  const REMOVE_EVENT_LISTENER = patchOptions && patchOptions.rm || REMOVE_EVENT_LISTENER_STR;
1944
2008
  const LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.listeners || 'eventListeners';
@@ -1963,9 +2027,19 @@ function patchEventTarget(_global, apis, patchOptions) {
1963
2027
 
1964
2028
  task.originalDelegate = delegate;
1965
2029
  } // invoke static task.invoke
2030
+ // need to try/catch error here, otherwise, the error in one event listener
2031
+ // will break the executions of the other event listeners. Also error will
2032
+ // not remove the event listener when `once` options is true.
1966
2033
 
1967
2034
 
1968
- task.invoke(task, target, [event]);
2035
+ let error;
2036
+
2037
+ try {
2038
+ task.invoke(task, target, [event]);
2039
+ } catch (err) {
2040
+ error = err;
2041
+ }
2042
+
1969
2043
  const options = task.options;
1970
2044
 
1971
2045
  if (options && typeof options === 'object' && options.once) {
@@ -1975,10 +2049,11 @@ function patchEventTarget(_global, apis, patchOptions) {
1975
2049
  const delegate = task.originalDelegate ? task.originalDelegate : task.callback;
1976
2050
  target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate, options);
1977
2051
  }
1978
- }; // global shared zoneAwareCallback to handle all event callback with capture = false
1979
2052
 
2053
+ return error;
2054
+ };
1980
2055
 
1981
- const globalZoneAwareCallback = function (event) {
2056
+ function globalCallback(context, event, isCapture) {
1982
2057
  // https://github.com/angular/zone.js/issues/911, in IE, sometimes
1983
2058
  // event will be undefined, so we need to use window.event
1984
2059
  event = event || _global.event;
@@ -1989,14 +2064,16 @@ function patchEventTarget(_global, apis, patchOptions) {
1989
2064
  // || global is needed https://github.com/angular/zone.js/issues/190
1990
2065
 
1991
2066
 
1992
- const target = this || event.target || _global;
1993
- const tasks = target[zoneSymbolEventNames$1[event.type][FALSE_STR]];
2067
+ const target = context || event.target || _global;
2068
+ const tasks = target[zoneSymbolEventNames[event.type][isCapture ? TRUE_STR : FALSE_STR]];
1994
2069
 
1995
2070
  if (tasks) {
1996
- // invoke all tasks which attached to current target with given event.type and capture = false
2071
+ const errors = []; // invoke all tasks which attached to current target with given event.type and capture = false
1997
2072
  // for performance concern, if task.length === 1, just invoke
2073
+
1998
2074
  if (tasks.length === 1) {
1999
- invokeTask(tasks[0], target, event);
2075
+ const err = invokeTask(tasks[0], target, event);
2076
+ err && errors.push(err);
2000
2077
  } else {
2001
2078
  // https://github.com/angular/zone.js/issues/836
2002
2079
  // copy the tasks array before invoke, to avoid
@@ -2008,47 +2085,34 @@ function patchEventTarget(_global, apis, patchOptions) {
2008
2085
  break;
2009
2086
  }
2010
2087
 
2011
- invokeTask(copyTasks[i], target, event);
2088
+ const err = invokeTask(copyTasks[i], target, event);
2089
+ err && errors.push(err);
2012
2090
  }
2013
- }
2014
- }
2015
- }; // global shared zoneAwareCallback to handle all event callback with capture = true
2016
-
2091
+ } // Since there is only one error, we don't need to schedule microTask
2092
+ // to throw the error.
2017
2093
 
2018
- const globalZoneAwareCaptureCallback = function (event) {
2019
- // https://github.com/angular/zone.js/issues/911, in IE, sometimes
2020
- // event will be undefined, so we need to use window.event
2021
- event = event || _global.event;
2022
2094
 
2023
- if (!event) {
2024
- return;
2025
- } // event.target is needed for Samsung TV and SourceBuffer
2026
- // || global is needed https://github.com/angular/zone.js/issues/190
2027
-
2028
-
2029
- const target = this || event.target || _global;
2030
- const tasks = target[zoneSymbolEventNames$1[event.type][TRUE_STR]];
2031
-
2032
- if (tasks) {
2033
- // invoke all tasks which attached to current target with given event.type and capture = false
2034
- // for performance concern, if task.length === 1, just invoke
2035
- if (tasks.length === 1) {
2036
- invokeTask(tasks[0], target, event);
2095
+ if (errors.length === 1) {
2096
+ throw errors[0];
2037
2097
  } else {
2038
- // https://github.com/angular/zone.js/issues/836
2039
- // copy the tasks array before invoke, to avoid
2040
- // the callback will remove itself or other listener
2041
- const copyTasks = tasks.slice();
2042
-
2043
- for (let i = 0; i < copyTasks.length; i++) {
2044
- if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {
2045
- break;
2046
- }
2047
-
2048
- invokeTask(copyTasks[i], target, event);
2098
+ for (let i = 0; i < errors.length; i++) {
2099
+ const err = errors[i];
2100
+ api.nativeScheduleMicroTask(() => {
2101
+ throw err;
2102
+ });
2049
2103
  }
2050
2104
  }
2051
2105
  }
2106
+ } // global shared zoneAwareCallback to handle all event callback with capture = false
2107
+
2108
+
2109
+ const globalZoneAwareCallback = function (event) {
2110
+ return globalCallback(this, event, false);
2111
+ }; // global shared zoneAwareCallback to handle all event callback with capture = true
2112
+
2113
+
2114
+ const globalZoneAwareCaptureCallback = function (event) {
2115
+ return globalCallback(this, event, true);
2052
2116
  };
2053
2117
 
2054
2118
  function patchEventTargetMethods(obj, patchOptions) {
@@ -2162,7 +2226,7 @@ function patchEventTarget(_global, apis, patchOptions) {
2162
2226
  // from Zone.prototype.cancelTask, we should remove the task
2163
2227
  // from tasksList of target first
2164
2228
  if (!task.isRemoved) {
2165
- const symbolEventNames = zoneSymbolEventNames$1[task.eventName];
2229
+ const symbolEventNames = zoneSymbolEventNames[task.eventName];
2166
2230
  let symbolEventName;
2167
2231
 
2168
2232
  if (symbolEventNames) {
@@ -2284,11 +2348,11 @@ function patchEventTarget(_global, apis, patchOptions) {
2284
2348
  const capture = !options ? false : typeof options === 'boolean' ? true : options.capture;
2285
2349
  const once = options && typeof options === 'object' ? options.once : false;
2286
2350
  const zone = Zone.current;
2287
- let symbolEventNames = zoneSymbolEventNames$1[eventName];
2351
+ let symbolEventNames = zoneSymbolEventNames[eventName];
2288
2352
 
2289
2353
  if (!symbolEventNames) {
2290
2354
  prepareEventNames(eventName, eventNameToString);
2291
- symbolEventNames = zoneSymbolEventNames$1[eventName];
2355
+ symbolEventNames = zoneSymbolEventNames[eventName];
2292
2356
  }
2293
2357
 
2294
2358
  const symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];
@@ -2412,7 +2476,7 @@ function patchEventTarget(_global, apis, patchOptions) {
2412
2476
  return;
2413
2477
  }
2414
2478
 
2415
- const symbolEventNames = zoneSymbolEventNames$1[eventName];
2479
+ const symbolEventNames = zoneSymbolEventNames[eventName];
2416
2480
  let symbolEventName;
2417
2481
 
2418
2482
  if (symbolEventNames) {
@@ -2509,7 +2573,7 @@ function patchEventTarget(_global, apis, patchOptions) {
2509
2573
  eventName = patchOptions.transferEventName(eventName);
2510
2574
  }
2511
2575
 
2512
- const symbolEventNames = zoneSymbolEventNames$1[eventName];
2576
+ const symbolEventNames = zoneSymbolEventNames[eventName];
2513
2577
 
2514
2578
  if (symbolEventNames) {
2515
2579
  const symbolEventName = symbolEventNames[FALSE_STR];
@@ -2590,11 +2654,11 @@ function findEventTasks(target, eventName) {
2590
2654
  return foundTasks;
2591
2655
  }
2592
2656
 
2593
- let symbolEventName = zoneSymbolEventNames$1[eventName];
2657
+ let symbolEventName = zoneSymbolEventNames[eventName];
2594
2658
 
2595
2659
  if (!symbolEventName) {
2596
2660
  prepareEventNames(eventName);
2597
- symbolEventName = zoneSymbolEventNames$1[eventName];
2661
+ symbolEventName = zoneSymbolEventNames[eventName];
2598
2662
  }
2599
2663
 
2600
2664
  const captureFalseTasks = target[symbolEventName[FALSE_STR]];
@@ -2642,20 +2706,31 @@ function patchCallbacks(api, target, targetName, method, callbacks) {
2642
2706
  if (opts && opts.prototype) {
2643
2707
  callbacks.forEach(function (callback) {
2644
2708
  const source = `${targetName}.${method}::` + callback;
2645
- const prototype = opts.prototype;
2709
+ const prototype = opts.prototype; // Note: the `patchCallbacks` is used for patching the `document.registerElement` and
2710
+ // `customElements.define`. We explicitly wrap the patching code into try-catch since
2711
+ // callbacks may be already patched by other web components frameworks (e.g. LWC), and they
2712
+ // make those properties non-writable. This means that patching callback will throw an error
2713
+ // `cannot assign to read-only property`. See this code as an example:
2714
+ // https://github.com/salesforce/lwc/blob/master/packages/@lwc/engine-core/src/framework/base-bridge-element.ts#L180-L186
2715
+ // We don't want to stop the application rendering if we couldn't patch some
2716
+ // callback, e.g. `attributeChangedCallback`.
2646
2717
 
2647
- if (prototype.hasOwnProperty(callback)) {
2648
- const descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback);
2718
+ try {
2719
+ if (prototype.hasOwnProperty(callback)) {
2720
+ const descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback);
2649
2721
 
2650
- if (descriptor && descriptor.value) {
2651
- descriptor.value = api.wrapWithCurrentZone(descriptor.value, source);
2722
+ if (descriptor && descriptor.value) {
2723
+ descriptor.value = api.wrapWithCurrentZone(descriptor.value, source);
2652
2724
 
2653
- api._redefineProperty(opts.prototype, callback, descriptor);
2725
+ api._redefineProperty(opts.prototype, callback, descriptor);
2726
+ } else if (prototype[callback]) {
2727
+ prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);
2728
+ }
2654
2729
  } else if (prototype[callback]) {
2655
2730
  prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);
2656
2731
  }
2657
- } else if (prototype[callback]) {
2658
- prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);
2732
+ } catch (_a) {// Note: we leave the catch block empty since there's no way to handle the error related
2733
+ // to non-writable property.
2659
2734
  }
2660
2735
  });
2661
2736
  }
@@ -2674,24 +2749,6 @@ function patchCallbacks(api, target, targetName, method, callbacks) {
2674
2749
  */
2675
2750
 
2676
2751
 
2677
- const globalEventHandlersEventNames = ['abort', 'animationcancel', 'animationend', 'animationiteration', 'auxclick', 'beforeinput', 'blur', 'cancel', 'canplay', 'canplaythrough', 'change', 'compositionstart', 'compositionupdate', 'compositionend', 'cuechange', 'click', 'close', 'contextmenu', 'curechange', 'dblclick', 'drag', 'dragend', 'dragenter', 'dragexit', 'dragleave', 'dragover', 'drop', 'durationchange', 'emptied', 'ended', 'error', 'focus', 'focusin', 'focusout', 'gotpointercapture', 'input', 'invalid', 'keydown', 'keypress', 'keyup', 'load', 'loadstart', 'loadeddata', 'loadedmetadata', 'lostpointercapture', 'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'mousewheel', 'orientationchange', 'pause', 'play', 'playing', 'pointercancel', 'pointerdown', 'pointerenter', 'pointerleave', 'pointerlockchange', 'mozpointerlockchange', 'webkitpointerlockerchange', 'pointerlockerror', 'mozpointerlockerror', 'webkitpointerlockerror', 'pointermove', 'pointout', 'pointerover', 'pointerup', 'progress', 'ratechange', 'reset', 'resize', 'scroll', 'seeked', 'seeking', 'select', 'selectionchange', 'selectstart', 'show', 'sort', 'stalled', 'submit', 'suspend', 'timeupdate', 'volumechange', 'touchcancel', 'touchmove', 'touchstart', 'touchend', 'transitioncancel', 'transitionend', 'waiting', 'wheel'];
2678
- const documentEventNames = ['afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange', 'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror', 'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange', 'visibilitychange', 'resume'];
2679
- const windowEventNames = ['absolutedeviceorientation', 'afterinput', 'afterprint', 'appinstalled', 'beforeinstallprompt', 'beforeprint', 'beforeunload', 'devicelight', 'devicemotion', 'deviceorientation', 'deviceorientationabsolute', 'deviceproximity', 'hashchange', 'languagechange', 'message', 'mozbeforepaint', 'offline', 'online', 'paint', 'pageshow', 'pagehide', 'popstate', 'rejectionhandled', 'storage', 'unhandledrejection', 'unload', 'userproximity', 'vrdisplayconnected', 'vrdisplaydisconnected', 'vrdisplaypresentchange'];
2680
- const htmlElementEventNames = ['beforecopy', 'beforecut', 'beforepaste', 'copy', 'cut', 'paste', 'dragstart', 'loadend', 'animationstart', 'search', 'transitionrun', 'transitionstart', 'webkitanimationend', 'webkitanimationiteration', 'webkitanimationstart', 'webkittransitionend'];
2681
- const mediaElementEventNames = ['encrypted', 'waitingforkey', 'msneedkey', 'mozinterruptbegin', 'mozinterruptend'];
2682
- const ieElementEventNames = ['activate', 'afterupdate', 'ariarequest', 'beforeactivate', 'beforedeactivate', 'beforeeditfocus', 'beforeupdate', 'cellchange', 'controlselect', 'dataavailable', 'datasetchanged', 'datasetcomplete', 'errorupdate', 'filterchange', 'layoutcomplete', 'losecapture', 'move', 'moveend', 'movestart', 'propertychange', 'resizeend', 'resizestart', 'rowenter', 'rowexit', 'rowsdelete', 'rowsinserted', 'command', 'compassneedscalibration', 'deactivate', 'help', 'mscontentzoom', 'msmanipulationstatechanged', 'msgesturechange', 'msgesturedoubletap', 'msgestureend', 'msgesturehold', 'msgesturestart', 'msgesturetap', 'msgotpointercapture', 'msinertiastart', 'mslostpointercapture', 'mspointercancel', 'mspointerdown', 'mspointerenter', 'mspointerhover', 'mspointerleave', 'mspointermove', 'mspointerout', 'mspointerover', 'mspointerup', 'pointerout', 'mssitemodejumplistitemremoved', 'msthumbnailclick', 'stop', 'storagecommit'];
2683
- const webglEventNames = ['webglcontextrestored', 'webglcontextlost', 'webglcontextcreationerror'];
2684
- const formEventNames = ['autocomplete', 'autocompleteerror'];
2685
- const detailEventNames = ['toggle'];
2686
- const frameEventNames = ['load'];
2687
- const frameSetEventNames = ['blur', 'error', 'focus', 'load', 'resize', 'scroll', 'messageerror'];
2688
- const marqueeEventNames = ['bounce', 'finish', 'start'];
2689
- const XMLHttpRequestEventNames = ['loadstart', 'progress', 'abort', 'error', 'load', 'progress', 'timeout', 'loadend', 'readystatechange'];
2690
- const IDBIndexEventNames = ['upgradeneeded', 'complete', 'abort', 'success', 'error', 'blocked', 'versionchange', 'close'];
2691
- const websocketEventNames = ['close', 'error', 'open', 'message'];
2692
- const workerEventNames = ['error', 'message'];
2693
- const eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);
2694
-
2695
2752
  function filterProperties(target, onProperties, ignoreProperties) {
2696
2753
  if (!ignoreProperties || ignoreProperties.length === 0) {
2697
2754
  return onProperties;
@@ -2717,6 +2774,15 @@ function patchFilteredProperties(target, onProperties, ignoreProperties, prototy
2717
2774
  const filteredProperties = filterProperties(target, onProperties, ignoreProperties);
2718
2775
  patchOnProperties(target, filteredProperties, prototype);
2719
2776
  }
2777
+ /**
2778
+ * Get all event name properties which the event name startsWith `on`
2779
+ * from the target object itself, inherited properties are not considered.
2780
+ */
2781
+
2782
+
2783
+ function getOnEventNames(target) {
2784
+ return Object.getOwnPropertyNames(target).filter(name => name.startsWith('on') && name.length > 2).map(name => name.substring(2));
2785
+ }
2720
2786
 
2721
2787
  function propertyDescriptorPatch(api, _global) {
2722
2788
  if (isNode && !isMix) {
@@ -2728,68 +2794,27 @@ function propertyDescriptorPatch(api, _global) {
2728
2794
  return;
2729
2795
  }
2730
2796
 
2731
- const supportsWebSocket = typeof WebSocket !== 'undefined';
2732
2797
  const ignoreProperties = _global['__Zone_ignore_on_properties']; // for browsers that we can patch the descriptor: Chrome & Firefox
2733
2798
 
2799
+ let patchTargets = [];
2800
+
2734
2801
  if (isBrowser) {
2735
2802
  const internalWindow = window;
2803
+ patchTargets = patchTargets.concat(['Document', 'SVGElement', 'Element', 'HTMLElement', 'HTMLBodyElement', 'HTMLMediaElement', 'HTMLFrameSetElement', 'HTMLFrameElement', 'HTMLIFrameElement', 'HTMLMarqueeElement', 'Worker']);
2736
2804
  const ignoreErrorProperties = isIE() ? [{
2737
2805
  target: internalWindow,
2738
2806
  ignoreProperties: ['error']
2739
2807
  }] : []; // in IE/Edge, onProp not exist in window object, but in WindowPrototype
2740
2808
  // so we need to pass WindowPrototype to check onProp exist or not
2741
2809
 
2742
- patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));
2743
- patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);
2744
-
2745
- if (typeof internalWindow['SVGElement'] !== 'undefined') {
2746
- patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);
2747
- }
2748
-
2749
- patchFilteredProperties(Element.prototype, eventNames, ignoreProperties);
2750
- patchFilteredProperties(HTMLElement.prototype, eventNames, ignoreProperties);
2751
- patchFilteredProperties(HTMLMediaElement.prototype, mediaElementEventNames, ignoreProperties);
2752
- patchFilteredProperties(HTMLFrameSetElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);
2753
- patchFilteredProperties(HTMLBodyElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);
2754
- patchFilteredProperties(HTMLFrameElement.prototype, frameEventNames, ignoreProperties);
2755
- patchFilteredProperties(HTMLIFrameElement.prototype, frameEventNames, ignoreProperties);
2756
- const HTMLMarqueeElement = internalWindow['HTMLMarqueeElement'];
2757
-
2758
- if (HTMLMarqueeElement) {
2759
- patchFilteredProperties(HTMLMarqueeElement.prototype, marqueeEventNames, ignoreProperties);
2760
- }
2761
-
2762
- const Worker = internalWindow['Worker'];
2763
-
2764
- if (Worker) {
2765
- patchFilteredProperties(Worker.prototype, workerEventNames, ignoreProperties);
2766
- }
2767
- }
2768
-
2769
- const XMLHttpRequest = _global['XMLHttpRequest'];
2770
-
2771
- if (XMLHttpRequest) {
2772
- // XMLHttpRequest is not available in ServiceWorker, so we need to check here
2773
- patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);
2810
+ patchFilteredProperties(internalWindow, getOnEventNames(internalWindow), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));
2774
2811
  }
2775
2812
 
2776
- const XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget'];
2777
-
2778
- if (XMLHttpRequestEventTarget) {
2779
- patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties);
2780
- }
2813
+ patchTargets = patchTargets.concat(['XMLHttpRequest', 'XMLHttpRequestEventTarget', 'IDBIndex', 'IDBRequest', 'IDBOpenDBRequest', 'IDBDatabase', 'IDBTransaction', 'IDBCursor', 'WebSocket']);
2781
2814
 
2782
- if (typeof IDBIndex !== 'undefined') {
2783
- patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);
2784
- patchFilteredProperties(IDBRequest.prototype, IDBIndexEventNames, ignoreProperties);
2785
- patchFilteredProperties(IDBOpenDBRequest.prototype, IDBIndexEventNames, ignoreProperties);
2786
- patchFilteredProperties(IDBDatabase.prototype, IDBIndexEventNames, ignoreProperties);
2787
- patchFilteredProperties(IDBTransaction.prototype, IDBIndexEventNames, ignoreProperties);
2788
- patchFilteredProperties(IDBCursor.prototype, IDBIndexEventNames, ignoreProperties);
2789
- }
2790
-
2791
- if (supportsWebSocket) {
2792
- patchFilteredProperties(WebSocket.prototype, websocketEventNames, ignoreProperties);
2815
+ for (let i = 0; i < patchTargets.length; i++) {
2816
+ const target = _global[patchTargets[i]];
2817
+ target && target.prototype && patchFilteredProperties(target.prototype, getOnEventNames(target.prototype), ignoreProperties);
2793
2818
  }
2794
2819
  }
2795
2820
  /**
@@ -2802,6 +2827,9 @@ function propertyDescriptorPatch(api, _global) {
2802
2827
 
2803
2828
 
2804
2829
  Zone.__load_patch('util', (global, Zone, api) => {
2830
+ // Collect native event names by looking at properties
2831
+ // on the global namespace, e.g. 'onclick'.
2832
+ const eventNames = getOnEventNames(global);
2805
2833
  api.patchOnProperties = patchOnProperties;
2806
2834
  api.patchMethod = patchMethod;
2807
2835
  api.bindArguments = bindArguments;
@@ -2840,7 +2868,7 @@ Zone.__load_patch('util', (global, Zone, api) => {
2840
2868
 
2841
2869
  api.getGlobalObjects = () => ({
2842
2870
  globalSources,
2843
- zoneSymbolEventNames: zoneSymbolEventNames$1,
2871
+ zoneSymbolEventNames,
2844
2872
  eventNames,
2845
2873
  isBrowser,
2846
2874
  isMix,
@@ -3050,7 +3078,7 @@ function eventTargetPatch(_global, api) {
3050
3078
  return;
3051
3079
  }
3052
3080
 
3053
- api.patchEventTarget(_global, [EVENT_TARGET && EVENT_TARGET.prototype]);
3081
+ api.patchEventTarget(_global, api, [EVENT_TARGET && EVENT_TARGET.prototype]);
3054
3082
  return true;
3055
3083
  }
3056
3084
 
@@ -3116,7 +3144,7 @@ Zone.__load_patch('EventTarget', (global, Zone, api) => {
3116
3144
  const XMLHttpRequestEventTarget = global['XMLHttpRequestEventTarget'];
3117
3145
 
3118
3146
  if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {
3119
- api.patchEventTarget(global, [XMLHttpRequestEventTarget.prototype]);
3147
+ api.patchEventTarget(global, api, [XMLHttpRequestEventTarget.prototype]);
3120
3148
  }
3121
3149
  });
3122
3150