[6a3a178] | 1 | 'use strict';
|
---|
| 2 | /**
|
---|
| 3 | * @license Angular v12.0.0-next.0
|
---|
| 4 | * (c) 2010-2020 Google LLC. https://angular.io/
|
---|
| 5 | * License: MIT
|
---|
| 6 | */
|
---|
| 7 | (function (factory) {
|
---|
| 8 | typeof define === 'function' && define.amd ? define(factory) :
|
---|
| 9 | factory();
|
---|
| 10 | }((function () {
|
---|
| 11 | 'use strict';
|
---|
| 12 | /**
|
---|
| 13 | * @license
|
---|
| 14 | * Copyright Google LLC All Rights Reserved.
|
---|
| 15 | *
|
---|
| 16 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 17 | * found in the LICENSE file at https://angular.io/license
|
---|
| 18 | */
|
---|
| 19 | /**
|
---|
| 20 | * @fileoverview
|
---|
| 21 | * @suppress {missingRequire}
|
---|
| 22 | */
|
---|
| 23 | (function (global) {
|
---|
| 24 | // Detect and setup WTF.
|
---|
| 25 | var wtfTrace = null;
|
---|
| 26 | var wtfEvents = null;
|
---|
| 27 | var wtfEnabled = (function () {
|
---|
| 28 | var wtf = global['wtf'];
|
---|
| 29 | if (wtf) {
|
---|
| 30 | wtfTrace = wtf.trace;
|
---|
| 31 | if (wtfTrace) {
|
---|
| 32 | wtfEvents = wtfTrace.events;
|
---|
| 33 | return true;
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 | return false;
|
---|
| 37 | })();
|
---|
| 38 | var WtfZoneSpec = /** @class */ (function () {
|
---|
| 39 | function WtfZoneSpec() {
|
---|
| 40 | this.name = 'WTF';
|
---|
| 41 | }
|
---|
| 42 | WtfZoneSpec.prototype.onFork = function (parentZoneDelegate, currentZone, targetZone, zoneSpec) {
|
---|
| 43 | var retValue = parentZoneDelegate.fork(targetZone, zoneSpec);
|
---|
| 44 | WtfZoneSpec.forkInstance(zonePathName(targetZone), retValue.name);
|
---|
| 45 | return retValue;
|
---|
| 46 | };
|
---|
| 47 | WtfZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
|
---|
| 48 | var src = source || 'unknown';
|
---|
| 49 | var scope = WtfZoneSpec.invokeScope[src];
|
---|
| 50 | if (!scope) {
|
---|
| 51 | scope = WtfZoneSpec.invokeScope[src] =
|
---|
| 52 | wtfEvents.createScope("Zone:invoke:" + source + "(ascii zone)");
|
---|
| 53 | }
|
---|
| 54 | return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source));
|
---|
| 55 | };
|
---|
| 56 | WtfZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
|
---|
| 57 | return parentZoneDelegate.handleError(targetZone, error);
|
---|
| 58 | };
|
---|
| 59 | WtfZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
|
---|
| 60 | var key = task.type + ':' + task.source;
|
---|
| 61 | var instance = WtfZoneSpec.scheduleInstance[key];
|
---|
| 62 | if (!instance) {
|
---|
| 63 | instance = WtfZoneSpec.scheduleInstance[key] =
|
---|
| 64 | wtfEvents.createInstance("Zone:schedule:" + key + "(ascii zone, any data)");
|
---|
| 65 | }
|
---|
| 66 | var retValue = parentZoneDelegate.scheduleTask(targetZone, task);
|
---|
| 67 | instance(zonePathName(targetZone), shallowObj(task.data, 2));
|
---|
| 68 | return retValue;
|
---|
| 69 | };
|
---|
| 70 | WtfZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
|
---|
| 71 | var source = task.source;
|
---|
| 72 | var scope = WtfZoneSpec.invokeTaskScope[source];
|
---|
| 73 | if (!scope) {
|
---|
| 74 | scope = WtfZoneSpec.invokeTaskScope[source] =
|
---|
| 75 | wtfEvents.createScope("Zone:invokeTask:" + source + "(ascii zone)");
|
---|
| 76 | }
|
---|
| 77 | return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs));
|
---|
| 78 | };
|
---|
| 79 | WtfZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
|
---|
| 80 | var key = task.source;
|
---|
| 81 | var instance = WtfZoneSpec.cancelInstance[key];
|
---|
| 82 | if (!instance) {
|
---|
| 83 | instance = WtfZoneSpec.cancelInstance[key] =
|
---|
| 84 | wtfEvents.createInstance("Zone:cancel:" + key + "(ascii zone, any options)");
|
---|
| 85 | }
|
---|
| 86 | var retValue = parentZoneDelegate.cancelTask(targetZone, task);
|
---|
| 87 | instance(zonePathName(targetZone), shallowObj(task.data, 2));
|
---|
| 88 | return retValue;
|
---|
| 89 | };
|
---|
| 90 | return WtfZoneSpec;
|
---|
| 91 | }());
|
---|
| 92 | WtfZoneSpec.forkInstance = wtfEnabled ? wtfEvents.createInstance('Zone:fork(ascii zone, ascii newZone)') : null;
|
---|
| 93 | WtfZoneSpec.scheduleInstance = {};
|
---|
| 94 | WtfZoneSpec.cancelInstance = {};
|
---|
| 95 | WtfZoneSpec.invokeScope = {};
|
---|
| 96 | WtfZoneSpec.invokeTaskScope = {};
|
---|
| 97 | function shallowObj(obj, depth) {
|
---|
| 98 | if (!obj || !depth)
|
---|
| 99 | return null;
|
---|
| 100 | var out = {};
|
---|
| 101 | for (var key in obj) {
|
---|
| 102 | if (obj.hasOwnProperty(key)) {
|
---|
| 103 | // explicit : any due to https://github.com/microsoft/TypeScript/issues/33191
|
---|
| 104 | var value = obj[key];
|
---|
| 105 | switch (typeof value) {
|
---|
| 106 | case 'object':
|
---|
| 107 | var name_1 = value && value.constructor && value.constructor.name;
|
---|
| 108 | value = name_1 == Object.name ? shallowObj(value, depth - 1) : name_1;
|
---|
| 109 | break;
|
---|
| 110 | case 'function':
|
---|
| 111 | value = value.name || undefined;
|
---|
| 112 | break;
|
---|
| 113 | }
|
---|
| 114 | out[key] = value;
|
---|
| 115 | }
|
---|
| 116 | }
|
---|
| 117 | return out;
|
---|
| 118 | }
|
---|
| 119 | function zonePathName(zone) {
|
---|
| 120 | var name = zone.name;
|
---|
| 121 | var localZone = zone.parent;
|
---|
| 122 | while (localZone != null) {
|
---|
| 123 | name = localZone.name + '::' + name;
|
---|
| 124 | localZone = localZone.parent;
|
---|
| 125 | }
|
---|
| 126 | return name;
|
---|
| 127 | }
|
---|
| 128 | Zone['wtfZoneSpec'] = !wtfEnabled ? null : new WtfZoneSpec();
|
---|
| 129 | })(typeof window === 'object' && window || typeof self === 'object' && self || global);
|
---|
| 130 | })));
|
---|