From 7a662378b63ce0bc24c40437895796f1d5cea6df Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 14 Sep 2016 11:02:38 -0700 Subject: [PATCH] chore: Release v0.6.22 --- dist/zone-node.js | 243 +++++++++++++++++++++++++++++++++++++++++++++- dist/zone.js | 156 +++++++++++++++-------------- dist/zone.min.js | 2 +- package.json | 2 +- 4 files changed, 327 insertions(+), 76 deletions(-) diff --git a/dist/zone-node.js b/dist/zone-node.js index 93337be61..4fc223d3e 100644 --- a/dist/zone-node.js +++ b/dist/zone-node.js @@ -553,7 +553,7 @@ var Zone$1 = (function (global) { if (NativePromise) { patchThen(NativePromise); if (typeof global['fetch'] !== 'undefined') { - var fetchPromise = global['fetch'](); + var fetchPromise = global['fetch']('about:blank'); // ignore output to prevent error; fetchPromise.then(function () { return null; }, function () { return null; }); if (fetchPromise.constructor != NativePromise) { @@ -572,12 +572,144 @@ var Zone$1 = (function (global) { * @suppress {undefinedVars} */ var zoneSymbol = Zone['__symbol__']; +var _global$1 = typeof window === 'object' && window || typeof self === 'object' && self || global; +function bindArguments(args, source) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = Zone.current.wrap(args[i], source + '_' + i); + } + } + return args; +} +; var isNode = (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'); var EVENT_TASKS = zoneSymbol('eventTasks'); +// For EventTarget var ADD_EVENT_LISTENER = 'addEventListener'; var REMOVE_EVENT_LISTENER = 'removeEventListener'; -var SYMBOL_ADD_EVENT_LISTENER = zoneSymbol(ADD_EVENT_LISTENER); -var SYMBOL_REMOVE_EVENT_LISTENER = zoneSymbol(REMOVE_EVENT_LISTENER); +function findExistingRegisteredTask(target, handler, name, capture, remove) { + var eventTasks = target[EVENT_TASKS]; + if (eventTasks) { + for (var i = 0; i < eventTasks.length; i++) { + var eventTask = eventTasks[i]; + var data = eventTask.data; + if (data.handler === handler + && data.useCapturing === capture + && data.eventName === name) { + if (remove) { + eventTasks.splice(i, 1); + } + return eventTask; + } + } + } + return null; +} +function attachRegisteredEvent(target, eventTask) { + var eventTasks = target[EVENT_TASKS]; + if (!eventTasks) { + eventTasks = target[EVENT_TASKS] = []; + } + eventTasks.push(eventTask); +} +function makeZoneAwareAddListener(addFnName, removeFnName, useCapturingParam, allowDuplicates) { + if (useCapturingParam === void 0) { useCapturingParam = true; } + if (allowDuplicates === void 0) { allowDuplicates = false; } + var addFnSymbol = zoneSymbol(addFnName); + var removeFnSymbol = zoneSymbol(removeFnName); + var defaultUseCapturing = useCapturingParam ? false : undefined; + function scheduleEventListener(eventTask) { + var meta = eventTask.data; + attachRegisteredEvent(meta.target, eventTask); + return meta.target[addFnSymbol](meta.eventName, eventTask.invoke, meta.useCapturing); + } + function cancelEventListener(eventTask) { + var meta = eventTask.data; + findExistingRegisteredTask(meta.target, eventTask.invoke, meta.eventName, meta.useCapturing, true); + meta.target[removeFnSymbol](meta.eventName, eventTask.invoke, meta.useCapturing); + } + return function zoneAwareAddListener(self, args) { + var eventName = args[0]; + var handler = args[1]; + var useCapturing = args[2] || defaultUseCapturing; + // - Inside a Web Worker, `this` is undefined, the context is `global` + // - When `addEventListener` is called on the global context in strict mode, `this` is undefined + // see https://github.com/angular/zone.js/issues/190 + var target = self || _global$1; + var delegate = null; + if (typeof handler == 'function') { + delegate = handler; + } + else if (handler && handler.handleEvent) { + delegate = function (event) { return handler.handleEvent(event); }; + } + var validZoneHandler = false; + try { + // In cross site contexts (such as WebDriver frameworks like Selenium), + // accessing the handler object here will cause an exception to be thrown which + // will fail tests prematurely. + validZoneHandler = handler && handler.toString() === "[object FunctionWrapper]"; + } + catch (e) { + // Returning nothing here is fine, because objects in a cross-site context are unusable + return; + } + // Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 + if (!delegate || validZoneHandler) { + return target[addFnSymbol](eventName, handler, useCapturing); + } + if (!allowDuplicates) { + var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, false); + if (eventTask) { + // we already registered, so this will have noop. + return target[addFnSymbol](eventName, eventTask.invoke, useCapturing); + } + } + var zone = Zone.current; + var source = target.constructor['name'] + '.' + addFnName + ':' + eventName; + var data = { + target: target, + eventName: eventName, + name: eventName, + useCapturing: useCapturing, + handler: handler + }; + zone.scheduleEventTask(source, delegate, data, scheduleEventListener, cancelEventListener); + }; +} +function makeZoneAwareRemoveListener(fnName, useCapturingParam) { + if (useCapturingParam === void 0) { useCapturingParam = true; } + var symbol = zoneSymbol(fnName); + var defaultUseCapturing = useCapturingParam ? false : undefined; + return function zoneAwareRemoveListener(self, args) { + var eventName = args[0]; + var handler = args[1]; + var useCapturing = args[2] || defaultUseCapturing; + // - Inside a Web Worker, `this` is undefined, the context is `global` + // - When `addEventListener` is called on the global context in strict mode, `this` is undefined + // see https://github.com/angular/zone.js/issues/190 + var target = self || _global$1; + var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, true); + if (eventTask) { + eventTask.zone.cancelTask(eventTask); + } + else { + target[symbol](eventName, handler, useCapturing); + } + }; +} +function makeZoneAwareListeners(fnName) { + var symbol = zoneSymbol(fnName); + return function zoneAwareEventListeners(self, args) { + var eventName = args[0]; + var target = self || _global$1; + return target[EVENT_TASKS] + .filter(function (task) { return task.data.eventName === eventName; }) + .map(function (task) { return task.data.handler; }); + }; +} +var zoneAwareAddEventListener = makeZoneAwareAddListener(ADD_EVENT_LISTENER, REMOVE_EVENT_LISTENER); +var zoneAwareRemoveEventListener = makeZoneAwareRemoveListener(REMOVE_EVENT_LISTENER); var originalInstanceKey = zoneSymbol('originalInstance'); function createNamedFn(name, delegate) { try { @@ -663,6 +795,93 @@ function patchTimer(window, setName, cancelName, nameSuffix) { }; }); } +// For EventEmitter +var EE_ADD_LISTENER = 'addListener'; +var EE_PREPEND_LISTENER = 'prependListener'; +var EE_REMOVE_LISTENER = 'removeListener'; +var EE_LISTENERS = 'listeners'; +var EE_ON = 'on'; +var zoneAwareAddListener = makeZoneAwareAddListener(EE_ADD_LISTENER, EE_REMOVE_LISTENER, false, true); +var zoneAwarePrependListener = makeZoneAwareAddListener(EE_PREPEND_LISTENER, EE_REMOVE_LISTENER, false, true); +var zoneAwareRemoveListener = makeZoneAwareRemoveListener(EE_REMOVE_LISTENER, false); +var zoneAwareListeners = makeZoneAwareListeners(EE_LISTENERS); +function patchEventEmitterMethods(obj) { + if (obj && obj.addListener) { + patchMethod(obj, EE_ADD_LISTENER, function () { return zoneAwareAddListener; }); + patchMethod(obj, EE_PREPEND_LISTENER, function () { return zoneAwarePrependListener; }); + patchMethod(obj, EE_REMOVE_LISTENER, function () { return zoneAwareRemoveListener; }); + patchMethod(obj, EE_LISTENERS, function () { return zoneAwareListeners; }); + obj[EE_ON] = obj[EE_ADD_LISTENER]; + return true; + } + else { + return false; + } +} +// EventEmitter +var events; +try { + events = require('events'); +} +catch (err) { } +if (events && events.EventEmitter) { + patchEventEmitterMethods(events.EventEmitter.prototype); +} + +var fs; +try { + fs = require('fs'); +} +catch (err) { } +// TODO(alxhub): Patch `watch` and `unwatchFile`. +var TO_PATCH = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'exists', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchmod', + 'lchown', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'read', + 'readdir', + 'readFile', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'write', + 'writeFile', +]; +if (fs) { + TO_PATCH + .filter(function (name) { return !!fs[name] && typeof fs[name] === 'function'; }) + .forEach(function (name) { + fs[name] = (function (delegate) { + return function () { + return delegate.apply(this, bindArguments(arguments, 'fs.' + name)); + }; + })(fs[name]); + }); +} + var set = 'set'; var clear = 'clear'; var _global = typeof window === 'object' && window || typeof self === 'object' && self || global; @@ -713,4 +932,22 @@ if (crypto) { return nativePbkdf2_1.apply(void 0, args); } }.bind(crypto); +} +// HTTP Client +var httpClient; +try { + httpClient = require('_http_client'); +} +catch (err) { } +if (httpClient && httpClient.ClientRequest) { + var ClientRequest_1 = httpClient.ClientRequest.bind(httpClient); + httpClient.ClientRequest = function (options, callback) { + if (!callback) { + return new ClientRequest_1(options); + } + else { + var zone = Zone.current; + return new ClientRequest_1(options, zone.wrap(callback, 'http.ClientRequest')); + } + }; } \ No newline at end of file diff --git a/dist/zone.js b/dist/zone.js index 9bc82236e..090435247 100644 --- a/dist/zone.js +++ b/dist/zone.js @@ -553,7 +553,7 @@ var Zone$1 = (function (global) { if (NativePromise) { patchThen(NativePromise); if (typeof global['fetch'] !== 'undefined') { - var fetchPromise = global['fetch'](); + var fetchPromise = global['fetch']('about:blank'); // ignore output to prevent error; fetchPromise.then(function () { return null; }, function () { return null; }); if (fetchPromise.constructor != NativePromise) { @@ -661,10 +661,9 @@ function patchOnProperties(obj, properties) { } ; var EVENT_TASKS = zoneSymbol('eventTasks'); +// For EventTarget var ADD_EVENT_LISTENER = 'addEventListener'; var REMOVE_EVENT_LISTENER = 'removeEventListener'; -var SYMBOL_ADD_EVENT_LISTENER = zoneSymbol(ADD_EVENT_LISTENER); -var SYMBOL_REMOVE_EVENT_LISTENER = zoneSymbol(REMOVE_EVENT_LISTENER); function findExistingRegisteredTask(target, handler, name, capture, remove) { var eventTasks = target[EVENT_TASKS]; if (eventTasks) { @@ -690,78 +689,94 @@ function attachRegisteredEvent(target, eventTask) { } eventTasks.push(eventTask); } -function scheduleEventListener(eventTask) { - var meta = eventTask.data; - attachRegisteredEvent(meta.target, eventTask); - return meta.target[SYMBOL_ADD_EVENT_LISTENER](meta.eventName, eventTask.invoke, meta.useCapturing); -} -function cancelEventListener(eventTask) { - var meta = eventTask.data; - findExistingRegisteredTask(meta.target, eventTask.invoke, meta.eventName, meta.useCapturing, true); - meta.target[SYMBOL_REMOVE_EVENT_LISTENER](meta.eventName, eventTask.invoke, meta.useCapturing); -} -function zoneAwareAddEventListener(self, args) { - var eventName = args[0]; - var handler = args[1]; - var useCapturing = args[2] || false; - // - Inside a Web Worker, `this` is undefined, the context is `global` - // - When `addEventListener` is called on the global context in strict mode, `this` is undefined - // see https://github.com/angular/zone.js/issues/190 - var target = self || _global$1; - var delegate = null; - if (typeof handler == 'function') { - delegate = handler; +function makeZoneAwareAddListener(addFnName, removeFnName, useCapturingParam, allowDuplicates) { + if (useCapturingParam === void 0) { useCapturingParam = true; } + if (allowDuplicates === void 0) { allowDuplicates = false; } + var addFnSymbol = zoneSymbol(addFnName); + var removeFnSymbol = zoneSymbol(removeFnName); + var defaultUseCapturing = useCapturingParam ? false : undefined; + function scheduleEventListener(eventTask) { + var meta = eventTask.data; + attachRegisteredEvent(meta.target, eventTask); + return meta.target[addFnSymbol](meta.eventName, eventTask.invoke, meta.useCapturing); } - else if (handler && handler.handleEvent) { - delegate = function (event) { return handler.handleEvent(event); }; - } - var validZoneHandler = false; - try { - // In cross site contexts (such as WebDriver frameworks like Selenium), - // accessing the handler object here will cause an exception to be thrown which - // will fail tests prematurely. - validZoneHandler = handler && handler.toString() === "[object FunctionWrapper]"; - } - catch (e) { - // Returning nothing here is fine, because objects in a cross-site context are unusable - return; + function cancelEventListener(eventTask) { + var meta = eventTask.data; + findExistingRegisteredTask(meta.target, eventTask.invoke, meta.eventName, meta.useCapturing, true); + meta.target[removeFnSymbol](meta.eventName, eventTask.invoke, meta.useCapturing); } - // Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 - if (!delegate || validZoneHandler) { - return target[SYMBOL_ADD_EVENT_LISTENER](eventName, handler, useCapturing); - } - var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, false); - if (eventTask) { - // we already registered, so this will have noop. - return target[SYMBOL_ADD_EVENT_LISTENER](eventName, eventTask.invoke, useCapturing); - } - var zone = Zone.current; - var source = target.constructor['name'] + '.addEventListener:' + eventName; - var data = { - target: target, - eventName: eventName, - name: eventName, - useCapturing: useCapturing, - handler: handler + return function zoneAwareAddListener(self, args) { + var eventName = args[0]; + var handler = args[1]; + var useCapturing = args[2] || defaultUseCapturing; + // - Inside a Web Worker, `this` is undefined, the context is `global` + // - When `addEventListener` is called on the global context in strict mode, `this` is undefined + // see https://github.com/angular/zone.js/issues/190 + var target = self || _global$1; + var delegate = null; + if (typeof handler == 'function') { + delegate = handler; + } + else if (handler && handler.handleEvent) { + delegate = function (event) { return handler.handleEvent(event); }; + } + var validZoneHandler = false; + try { + // In cross site contexts (such as WebDriver frameworks like Selenium), + // accessing the handler object here will cause an exception to be thrown which + // will fail tests prematurely. + validZoneHandler = handler && handler.toString() === "[object FunctionWrapper]"; + } + catch (e) { + // Returning nothing here is fine, because objects in a cross-site context are unusable + return; + } + // Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 + if (!delegate || validZoneHandler) { + return target[addFnSymbol](eventName, handler, useCapturing); + } + if (!allowDuplicates) { + var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, false); + if (eventTask) { + // we already registered, so this will have noop. + return target[addFnSymbol](eventName, eventTask.invoke, useCapturing); + } + } + var zone = Zone.current; + var source = target.constructor['name'] + '.' + addFnName + ':' + eventName; + var data = { + target: target, + eventName: eventName, + name: eventName, + useCapturing: useCapturing, + handler: handler + }; + zone.scheduleEventTask(source, delegate, data, scheduleEventListener, cancelEventListener); }; - zone.scheduleEventTask(source, delegate, data, scheduleEventListener, cancelEventListener); } -function zoneAwareRemoveEventListener(self, args) { - var eventName = args[0]; - var handler = args[1]; - var useCapturing = args[2] || false; - // - Inside a Web Worker, `this` is undefined, the context is `global` - // - When `addEventListener` is called on the global context in strict mode, `this` is undefined - // see https://github.com/angular/zone.js/issues/190 - var target = self || _global$1; - var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, true); - if (eventTask) { - eventTask.zone.cancelTask(eventTask); - } - else { - target[SYMBOL_REMOVE_EVENT_LISTENER](eventName, handler, useCapturing); - } +function makeZoneAwareRemoveListener(fnName, useCapturingParam) { + if (useCapturingParam === void 0) { useCapturingParam = true; } + var symbol = zoneSymbol(fnName); + var defaultUseCapturing = useCapturingParam ? false : undefined; + return function zoneAwareRemoveListener(self, args) { + var eventName = args[0]; + var handler = args[1]; + var useCapturing = args[2] || defaultUseCapturing; + // - Inside a Web Worker, `this` is undefined, the context is `global` + // - When `addEventListener` is called on the global context in strict mode, `this` is undefined + // see https://github.com/angular/zone.js/issues/190 + var target = self || _global$1; + var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, true); + if (eventTask) { + eventTask.zone.cancelTask(eventTask); + } + else { + target[symbol](eventName, handler, useCapturing); + } + }; } +var zoneAwareAddEventListener = makeZoneAwareAddListener(ADD_EVENT_LISTENER, REMOVE_EVENT_LISTENER); +var zoneAwareRemoveEventListener = makeZoneAwareRemoveListener(REMOVE_EVENT_LISTENER); function patchEventTargetMethods(obj) { if (obj && obj.addEventListener) { patchMethod(obj, ADD_EVENT_LISTENER, function () { return zoneAwareAddEventListener; }); @@ -772,7 +787,6 @@ function patchEventTargetMethods(obj) { return false; } } -; var originalInstanceKey = zoneSymbol('originalInstance'); // wrap some native API on `window` function patchClass(className) { diff --git a/dist/zone.min.js b/dist/zone.min.js index 169bb43da..59a6e46ad 100644 --- a/dist/zone.min.js +++ b/dist/zone.min.js @@ -1 +1 @@ -function bindArguments(e,t){for(var n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=Zone.current.wrap(e[n],t+"_"+n));return e}function patchPrototype(e,t){for(var n=e.constructor.name,r=function(r){var o=t[r],a=e[o];a&&(e[o]=function(e){return function(){return e.apply(this,bindArguments(arguments,n+"."+o))}}(a))},o=0;o1?new t(e,n):new t(e),a=Object.getOwnPropertyDescriptor(o,"onmessage");return a&&a.configurable===!1?(r=Object.create(o),["addEventListener","removeEventListener","send","close"].forEach(function(e){r[e]=function(){return o[e].apply(o,arguments)}})):r=o,patchOnProperties(r,["close","error","message","open"]),r};for(var n in t)e.WebSocket[n]=t[n]}function propertyDescriptorPatch(e){if(!isNode){var t="undefined"!=typeof WebSocket;canPatchViaPropertyDescriptor()?(isBrowser&&patchOnProperties(HTMLElement.prototype,eventNames),patchOnProperties(XMLHttpRequest.prototype,null),"undefined"!=typeof IDBIndex&&(patchOnProperties(IDBIndex.prototype,null),patchOnProperties(IDBRequest.prototype,null),patchOnProperties(IDBOpenDBRequest.prototype,null),patchOnProperties(IDBDatabase.prototype,null),patchOnProperties(IDBTransaction.prototype,null),patchOnProperties(IDBCursor.prototype,null)),t&&patchOnProperties(WebSocket.prototype,null)):(patchViaCapturingAllTheEvents(),patchClass("XMLHttpRequest"),t&&apply(e))}}function canPatchViaPropertyDescriptor(){if(isBrowser&&!Object.getOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var e=Object.getOwnPropertyDescriptor(Element.prototype,"onclick");if(e&&!e.configurable)return!1}Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{get:function(){return!0}});var t=new XMLHttpRequest,n=!!t.onreadystatechange;return Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{}),n}function patchViaCapturingAllTheEvents(){for(var e=function(e){var t=eventNames[e],n="on"+t;document.addEventListener(t,function(e){var t,r,o=e.target;for(r=o?o.constructor.name+"."+n:"unknown."+n;o;)o[n]&&!o[n][unboundKey]&&(t=Zone.current.wrap(o[n],r),t[unboundKey]=o[n],o[n]=t),o=o.parentElement},!0)},t=0;t",this._properties=t&&t.properties||{},this._zoneDelegate=new g(this,this._parent&&this._parent._zoneDelegate,t)}return n.assertZonePatched=function(){if(e.Promise!==L)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")},Object.defineProperty(n,"current",{get:function(){return T},enumerable:!0,configurable:!0}),Object.defineProperty(n,"currentTask",{get:function(){return b},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),n.prototype.get=function(e){var t=this.getZoneWith(e);if(t)return t._properties[e]},n.prototype.getZoneWith=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null},n.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},n.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}},n.prototype.run=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=T;T=this;try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{T=o}},n.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=T;T=this;try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{T=o}},n.prototype.runTask=function(e,t,n){if(e.runCount++,e.zone!=this)throw new Error("A task can only be run in the zone which created it! (Creation: "+e.zone.name+"; Execution: "+this.name+")");var r=b;b=e;var o=T;T=this;try{"macroTask"==e.type&&e.data&&!e.data.isPeriodic&&(e.cancelFn=null);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{T=o,b=r}},n.prototype.scheduleMicroTask=function(e,t,n,r){return this._zoneDelegate.scheduleTask(this,new y("microTask",this,e,t,n,r,null))},n.prototype.scheduleMacroTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new y("macroTask",this,e,t,n,r,o))},n.prototype.scheduleEventTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new y("eventTask",this,e,t,n,r,o))},n.prototype.cancelTask=function(e){var t=this._zoneDelegate.cancelTask(this,e);return e.runCount=-1,e.cancelFn=null,t},n.__symbol__=t,n}(),g=function(){function e(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._hasTaskZS=n&&(n.onHasTask?n:t._hasTaskZS),this._hasTaskDlgt=n&&(n.onHasTask?t:t._hasTaskDlgt)}return e.prototype.fork=function(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new d(e,t)},e.prototype.intercept=function(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this.zone,e,t,n):t},e.prototype.invoke=function(e,t,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this.zone,e,t,n,r,o):t.apply(n,r)},e.prototype.handleError=function(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this.zone,e,t)},e.prototype.scheduleTask=function(e,t){try{if(this._scheduleTaskZS)return this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this.zone,e,t);if(t.scheduleFn)t.scheduleFn(t);else{if("microTask"!=t.type)throw new Error("Task is missing scheduleFn.");r(t)}return t}finally{e==this.zone&&this._updateTaskCount(t.type,1)}},e.prototype.invokeTask=function(e,t,n,r){try{return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this.zone,e,t,n,r):t.callback.apply(n,r)}finally{e!=this.zone||"eventTask"==t.type||t.data&&t.data.isPeriodic||this._updateTaskCount(t.type,-1)}},e.prototype.cancelTask=function(e,t){var n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this.zone,e,t);else{if(!t.cancelFn)throw new Error("Task does not support cancellation, or is already canceled.");n=t.cancelFn(t)}return e==this.zone&&this._updateTaskCount(t.type,-1),n},e.prototype.hasTask=function(e,t){return this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this.zone,e,t)},e.prototype._updateTaskCount=function(e,t){var n=this._taskCounts,r=n[e],o=n[e]=r+t;if(o<0)throw new Error("More tasks executed then were scheduled.");if(0==r||0==o){var a={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};try{this.hasTask(this.zone,a)}finally{this._parentDelegate&&this._parentDelegate._updateTaskCount(e,t)}}},e}(),y=function(){function e(e,t,n,r,o,i,s){this.runCount=0,this.type=e,this.zone=t,this.source=n,this.data=o,this.scheduleFn=i,this.cancelFn=s,this.callback=r;var c=this;this.invoke=function(){S++;try{return t.runTask(c,this,arguments)}finally{1==S&&a(),S--}}}return e.prototype.toString=function(){return this.data&&"undefined"!=typeof this.data.handleId?this.data.handleId:this.toString()},e}(),v=t("setTimeout"),_=t("Promise"),k=t("then"),T=new d(null,null),b=null,E=[],m=!1,w=[],S=0,D=t("state"),P=t("value"),O="Promise.then",I=null,R=!0,M=!1,z=0,L=function(){function e(t){var n=this;if(!(n instanceof e))throw new Error("Must be an instanceof Promise.");n[D]=I,n[P]=[];try{t&&t(u(n,R),u(n,M))}catch(r){l(n,!1,r)}}return e.resolve=function(e){return l(new this(null),R,e)},e.reject=function(e){return l(new this(null),M,e)},e.race=function(e){function t(e){a&&(a=r(e))}function n(e){a&&(a=o(e))}for(var r,o,a=new this(function(e,t){r=e,o=t}),s=0,c=e;s=0;n--)"function"==typeof e[n]&&(e[n]=Zone.current.wrap(e[n],t+"_"+n));return e}function patchPrototype(e,t){for(var n=e.constructor.name,r=function(r){var o=t[r],a=e[o];a&&(e[o]=function(e){return function(){return e.apply(this,bindArguments(arguments,n+"."+o))}}(a))},o=0;o1?new t(e,n):new t(e),a=Object.getOwnPropertyDescriptor(o,"onmessage");return a&&a.configurable===!1?(r=Object.create(o),["addEventListener","removeEventListener","send","close"].forEach(function(e){r[e]=function(){return o[e].apply(o,arguments)}})):r=o,patchOnProperties(r,["close","error","message","open"]),r};for(var n in t)e.WebSocket[n]=t[n]}function propertyDescriptorPatch(e){if(!isNode){var t="undefined"!=typeof WebSocket;canPatchViaPropertyDescriptor()?(isBrowser&&patchOnProperties(HTMLElement.prototype,eventNames),patchOnProperties(XMLHttpRequest.prototype,null),"undefined"!=typeof IDBIndex&&(patchOnProperties(IDBIndex.prototype,null),patchOnProperties(IDBRequest.prototype,null),patchOnProperties(IDBOpenDBRequest.prototype,null),patchOnProperties(IDBDatabase.prototype,null),patchOnProperties(IDBTransaction.prototype,null),patchOnProperties(IDBCursor.prototype,null)),t&&patchOnProperties(WebSocket.prototype,null)):(patchViaCapturingAllTheEvents(),patchClass("XMLHttpRequest"),t&&apply(e))}}function canPatchViaPropertyDescriptor(){if(isBrowser&&!Object.getOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var e=Object.getOwnPropertyDescriptor(Element.prototype,"onclick");if(e&&!e.configurable)return!1}Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{get:function(){return!0}});var t=new XMLHttpRequest,n=!!t.onreadystatechange;return Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{}),n}function patchViaCapturingAllTheEvents(){for(var e=function(e){var t=eventNames[e],n="on"+t;document.addEventListener(t,function(e){var t,r,o=e.target;for(r=o?o.constructor.name+"."+n:"unknown."+n;o;)o[n]&&!o[n][unboundKey]&&(t=Zone.current.wrap(o[n],r),t[unboundKey]=o[n],o[n]=t),o=o.parentElement},!0)},t=0;t",this._properties=t&&t.properties||{},this._zoneDelegate=new g(this,this._parent&&this._parent._zoneDelegate,t)}return n.assertZonePatched=function(){if(e.Promise!==M)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")},Object.defineProperty(n,"current",{get:function(){return _},enumerable:!0,configurable:!0}),Object.defineProperty(n,"currentTask",{get:function(){return T},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),n.prototype.get=function(e){var t=this.getZoneWith(e);if(t)return t._properties[e]},n.prototype.getZoneWith=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null},n.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},n.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}},n.prototype.run=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=_;_=this;try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{_=o}},n.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=_;_=this;try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{_=o}},n.prototype.runTask=function(e,t,n){if(e.runCount++,e.zone!=this)throw new Error("A task can only be run in the zone which created it! (Creation: "+e.zone.name+"; Execution: "+this.name+")");var r=T;T=e;var o=_;_=this;try{"macroTask"==e.type&&e.data&&!e.data.isPeriodic&&(e.cancelFn=null);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{_=o,T=r}},n.prototype.scheduleMicroTask=function(e,t,n,r){return this._zoneDelegate.scheduleTask(this,new y("microTask",this,e,t,n,r,null))},n.prototype.scheduleMacroTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new y("macroTask",this,e,t,n,r,o))},n.prototype.scheduleEventTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new y("eventTask",this,e,t,n,r,o))},n.prototype.cancelTask=function(e){var t=this._zoneDelegate.cancelTask(this,e);return e.runCount=-1,e.cancelFn=null,t},n.__symbol__=t,n}(),g=function(){function e(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._hasTaskZS=n&&(n.onHasTask?n:t._hasTaskZS),this._hasTaskDlgt=n&&(n.onHasTask?t:t._hasTaskDlgt)}return e.prototype.fork=function(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new d(e,t)},e.prototype.intercept=function(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this.zone,e,t,n):t},e.prototype.invoke=function(e,t,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this.zone,e,t,n,r,o):t.apply(n,r)},e.prototype.handleError=function(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this.zone,e,t)},e.prototype.scheduleTask=function(e,t){try{if(this._scheduleTaskZS)return this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this.zone,e,t);if(t.scheduleFn)t.scheduleFn(t);else{if("microTask"!=t.type)throw new Error("Task is missing scheduleFn.");r(t)}return t}finally{e==this.zone&&this._updateTaskCount(t.type,1)}},e.prototype.invokeTask=function(e,t,n,r){try{return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this.zone,e,t,n,r):t.callback.apply(n,r)}finally{e!=this.zone||"eventTask"==t.type||t.data&&t.data.isPeriodic||this._updateTaskCount(t.type,-1)}},e.prototype.cancelTask=function(e,t){var n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this.zone,e,t);else{if(!t.cancelFn)throw new Error("Task does not support cancellation, or is already canceled.");n=t.cancelFn(t)}return e==this.zone&&this._updateTaskCount(t.type,-1),n},e.prototype.hasTask=function(e,t){return this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this.zone,e,t)},e.prototype._updateTaskCount=function(e,t){var n=this._taskCounts,r=n[e],o=n[e]=r+t;if(o<0)throw new Error("More tasks executed then were scheduled.");if(0==r||0==o){var a={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};try{this.hasTask(this.zone,a)}finally{this._parentDelegate&&this._parentDelegate._updateTaskCount(e,t)}}},e}(),y=function(){function e(e,t,n,r,o,i,s){this.runCount=0,this.type=e,this.zone=t,this.source=n,this.data=o,this.scheduleFn=i,this.cancelFn=s,this.callback=r;var c=this;this.invoke=function(){S++;try{return t.runTask(c,this,arguments)}finally{1==S&&a(),S--}}}return e.prototype.toString=function(){return this.data&&"undefined"!=typeof this.data.handleId?this.data.handleId:this.toString()},e}(),v=t("setTimeout"),k=t("Promise"),b=t("then"),_=new d(null,null),T=null,m=[],E=!1,w=[],S=0,P=t("state"),D=t("value"),O="Promise.then",z=null,I=!0,R=!1,Z=0,M=function(){function e(t){var n=this;if(!(n instanceof e))throw new Error("Must be an instanceof Promise.");n[P]=z,n[D]=[];try{t&&t(u(n,I),u(n,R))}catch(r){l(n,!1,r)}}return e.resolve=function(e){return l(new this(null),I,e)},e.reject=function(e){return l(new this(null),R,e)},e.race=function(e){function t(e){a&&(a=r(e))}function n(e){a&&(a=o(e))}for(var r,o,a=new this(function(e,t){r=e,o=t}),s=0,c=e;s