"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n * (c) 2010-2022 Google LLC. https://angular.io/ * License: MIT */ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){!function(e){var t,n=e.performance;function r(e){n&&n.mark&&n.mark(e)}function o(e,t){n&&n.measure&&n.measure(e,t)}r("Zone");var i=e.__Zone_symbol_prefix||"__zone_symbol__";function a(e){return i+e}var s=!0===e[a("forceDuplicateZoneCheck")];if(e.Zone){if(s||"function"!=typeof e.Zone.__symbol__)throw new Error("Zone already loaded.");return e.Zone}var c=function(){function n(e,t){this._parent=e,this._name=t?t.name||"unnamed":"",this._properties=t&&t.properties||{},this._zoneDelegate=new h(this,this._parent&&this._parent._zoneDelegate,t)}return n.assertZonePatched=function(){if(e.Promise!==j.ZoneAwarePromise)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,"root",{get:function(){for(var e=t.current;e.parent;)e=e.parent;return e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"current",{get:function(){return I.zone},enumerable:!1,configurable:!0}),Object.defineProperty(n,"currentTask",{get:function(){return F},enumerable:!1,configurable:!0}),n.__load_patch=function(n,i,a){if(void 0===a&&(a=!1),j.hasOwnProperty(n)){if(!a&&s)throw Error("Already loaded patch: "+n)}else if(!e["__Zone_disable_"+n]){var c="Zone:"+n;r(c),j[n]=i(e,t,O),o(c,c)}},Object.defineProperty(n.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},enumerable:!1,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){I={parent:I,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{I=I.parent}},n.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),I={parent:I,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{I=I.parent}},n.prototype.runTask=function(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");if(e.state!==b||e.type!==A&&e.type!==C){var r=e.state!=w;r&&e._transitionTo(w,S),e.runCount++;var o=F;F=e,I={parent:I,zone:this};try{e.type==C&&e.data&&!e.data.isPeriodic&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{e.state!==b&&e.state!==Z&&(e.type==A||e.data&&e.data.isPeriodic?r&&e._transitionTo(S,w):(e.runCount=0,this._updateTaskCount(e,-1),r&&e._transitionTo(b,w,b))),I=I.parent,F=o}}},n.prototype.scheduleTask=function(e){if(e.zone&&e.zone!==this)for(var t=this;t;){if(t===e.zone)throw Error("can not reschedule task to ".concat(this.name," which is descendants of the original zone ").concat(e.zone.name));t=t.parent}e._transitionTo(E,b);var n=[];e._zoneDelegates=n,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(Z,E,b),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===n&&this._updateTaskCount(e,1),e.state==E&&e._transitionTo(S,E),e},n.prototype.scheduleMicroTask=function(e,t,n,r){return this.scheduleTask(new f(D,e,t,n,r,void 0))},n.prototype.scheduleMacroTask=function(e,t,n,r,o){return this.scheduleTask(new f(C,e,t,n,r,o))},n.prototype.scheduleEventTask=function(e,t,n,r,o){return this.scheduleTask(new f(A,e,t,n,r,o))},n.prototype.cancelTask=function(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");if(e.state===S||e.state===w){e._transitionTo(P,S,w);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(Z,P),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(b,P),e.runCount=0,e}},n.prototype._updateTaskCount=function(e,t){var n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(var r=0;r0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e})},e}(),f=function(){function t(n,r,o,i,a,s){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=n,this.source=r,this.data=i,this.scheduleFn=a,this.cancelFn=s,!o)throw new Error("callback is not defined");this.callback=o;var c=this;this.invoke=n===A&&i&&i.useG?t.invokeTask:function(){return t.invokeTask.call(e,c,this,arguments)}}return t.invokeTask=function(e,t,n){e||(e=this),x++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==x&&T(),x--}},Object.defineProperty(t.prototype,"zone",{get:function(){return this._zone},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.cancelScheduleRequest=function(){this._transitionTo(b,E)},t.prototype._transitionTo=function(e,t,n){if(this._state!==t&&this._state!==n)throw new Error("".concat(this.type," '").concat(this.source,"': can not transition to '").concat(e,"', expecting state '").concat(t,"'").concat(n?" or '"+n+"'":"",", was '").concat(this._state,"'."));this._state=e,e==b&&(this._zoneDelegates=null)},t.prototype.toString=function(){return this.data&&void 0!==this.data.handleId?this.data.handleId.toString():Object.prototype.toString.call(this)},t.prototype.toJSON=function(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}},t}(),p=a("setTimeout"),d=a("Promise"),y=a("then"),_=[],v=!1;function k(t){if(u||e[d]&&(u=e[d].resolve(0)),u){var n=u[y];n||(n=u.then),n.call(u,t)}else e[p](t,0)}function m(e){0===x&&0===_.length&&k(T),e&&_.push(e)}function T(){if(!v){for(v=!0;_.length;){var e=_;_=[];for(var t=0;t=0;n--)"function"==typeof e[n]&&(e[n]=f(e[n],t+"_"+n));return e}function T(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}var g="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,b=!("nw"in v)&&void 0!==v.process&&"[object process]"==={}.toString.call(v.process),E=!b&&!g&&!(!y||!_.HTMLElement),S=void 0!==v.process&&"[object process]"==={}.toString.call(v.process)&&!g&&!(!y||!_.HTMLElement),w={},P=function(e){if(e=e||v.event){var t=w[e.type];t||(t=w[e.type]=d("ON_PROPERTY"+e.type));var n,r=this||e.target||v,o=r[t];return E&&r===_&&"error"===e.type?!0===(n=o&&o.call(this,e.message,e.filename,e.lineno,e.colno,e.error))&&e.preventDefault():null==(n=o&&o.apply(this,arguments))||n||e.preventDefault(),n}};function Z(n,r,o){var i=e(n,r);if(!i&&o&&e(o,r)&&(i={enumerable:!0,configurable:!0}),i&&i.configurable){var a=d("on"+r+"patched");if(!n.hasOwnProperty(a)||!n[a]){delete i.writable,delete i.value;var s=i.get,c=i.set,u=r.slice(2),l=w[u];l||(l=w[u]=d("ON_PROPERTY"+u)),i.set=function(e){var t=this;t||n!==v||(t=v),t&&("function"==typeof t[l]&&t.removeEventListener(u,P),c&&c.call(t,null),t[l]=e,"function"==typeof e&&t.addEventListener(u,P,!1))},i.get=function(){var e=this;if(e||n!==v||(e=v),!e)return null;var t=e[l];if(t)return t;if(s){var o=s.call(this);if(o)return i.set.call(this,o),"function"==typeof e[k]&&e.removeAttribute(r),o}return null},t(n,r,i),n[a]=!0}}}function D(e,t,n){if(t)for(var r=0;r=0&&"function"==typeof r[i.cbIdx]?p(i.name,r[i.cbIdx],i,o):e.apply(t,r)}}))}function I(e,t){e[d("OriginalDelegate")]=t}var F=!1,x=!1;function M(){if(F)return x;F=!0;try{var e=_.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(x=!0)}catch(e){}return x}Zone.__load_patch("ZoneAwarePromise",(function(e,t,n){var r=Object.getOwnPropertyDescriptor,o=Object.defineProperty,i=n.symbol,a=[],s=!0===e[i("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],c=i("Promise"),u=i("then"),l="__creationTrace__";n.onUnhandledError=function(e){if(n.showUncaughtError()){var t=e&&e.rejection;t?console.error("Unhandled Promise rejection:",t instanceof Error?t.message:t,"; Zone:",e.zone.name,"; Task:",e.task&&e.task.source,"; Value:",t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=function(){for(var e=function(){var e=a.shift();try{e.zone.runGuarded((function(){if(e.throwOriginal)throw e.rejection;throw e}))}catch(e){!function r(e){n.onUnhandledError(e);try{var r=t[h];"function"==typeof r&&r.call(this,e)}catch(e){}}(e)}};a.length;)e()};var h=i("unhandledPromiseRejectionHandler");function f(e){return e&&e.then}function p(e){return e}function d(e){return M.reject(e)}var y=i("state"),_=i("value"),v=i("finally"),k=i("parentPromiseValue"),m=i("parentPromiseState"),T="Promise.then",g=null,b=!0,E=!1,S=0;function w(e,t){return function(n){try{C(e,t,n)}catch(t){C(e,!1,t)}}}var P=function(){var e=!1;return function t(n){return function(){e||(e=!0,n.apply(null,arguments))}}},Z="Promise resolved with itself",D=i("currentTaskTrace");function C(e,r,i){var c=P();if(e===i)throw new TypeError(Z);if(e[y]===g){var u=null;try{"object"!=typeof i&&"function"!=typeof i||(u=i&&i.then)}catch(t){return c((function(){C(e,!1,t)}))(),e}if(r!==E&&i instanceof M&&i.hasOwnProperty(y)&&i.hasOwnProperty(_)&&i[y]!==g)O(i),C(e,i[y],i[_]);else if(r!==E&&"function"==typeof u)try{u.call(i,c(w(e,r)),c(w(e,!1)))}catch(t){c((function(){C(e,!1,t)}))()}else{e[y]=r;var h=e[_];if(e[_]=i,e[v]===v&&r===b&&(e[y]=e[m],e[_]=e[k]),r===E&&i instanceof Error){var f=t.currentTask&&t.currentTask.data&&t.currentTask.data[l];f&&o(i,D,{configurable:!0,enumerable:!1,writable:!0,value:f})}for(var p=0;p2})).map((function(e){return e.substring(2)}))}function J(e,t){if((!b||S)&&!Zone[e.symbol("patchEvents")]){var r=t.__Zone_ignore_on_properties,o=[];if(E){var i=window;o=o.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);var a=function e(){try{var e=_.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch(e){}return!1}()?[{target:i,ignoreProperties:["error"]}]:[];K(i,Y(i),r?r.concat(a):r,n(i))}o=o.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(var s=0;s0){var i=e.invoke;e.invoke=function(){for(var r=o[t.__symbol__("loadfalse")],a=0;a0}function me(e,t){t>0&&(e.push(ye((new ue).error)),me(e,t-1))}Zone.longStackTraceZoneSpec={name:"long-stack-trace",longStackTraceLimit:10,getLongStackTrace:function(e){if(e){var t=e[Zone.__symbol__("currentTaskTrace")];return t?ve(t,e.stack):e.stack}},onScheduleTask:function(e,t,n,r){if(ke()){var o=Zone.currentTask,i=o&&o.data&&o.data[ie]||[];(i=[new ue].concat(i)).length>this.longStackTraceLimit&&(i.length=this.longStackTraceLimit),r.data||(r.data={}),"eventTask"===r.type&&(r.data=__assign({},r.data)),r.data[ie]=i}return e.scheduleTask(n,r)},onHandleError:function(e,t,n,r){if(ke()){var o=Zone.currentTask||r.task;if(r instanceof Error&&o){var i=ve(o.data&&o.data[ie],r.stack);try{r.stack=r.longStack=i}catch(e){}}}return e.handleError(n,r)}},function Te(){if(ke()){var e=[];me(e,2);for(var t=e[0],n=e[1],r=0;r0?arguments[0]:new Date;return e.setFakeBaseSystemTime.apply(e,n&&"function"==typeof n.getTime?[n.getTime()]:arguments)}return r.apply(this,arguments)},c&&["install","uninstall"].forEach((function(n){var r=e[a(n)]=e[n];e[n]=function(){if(!t.FakeAsyncTestZoneSpec)return r.apply(this,arguments);jasmine[a("clockInstalled")]="install"===n}}))}return e}}if(!jasmine[t.__symbol__("createSpyObj")]){var f=jasmine.createSpyObj;jasmine[t.__symbol__("createSpyObj")]=f,jasmine.createSpyObj=function(){var e,t=Array.prototype.slice.call(arguments);if(t.length>=3&&t[2]){var n=Object.defineProperty;Object.defineProperty=function(e,t,r){return n.call(this,e,t,__assign(__assign({},r),{configurable:!0,enumerable:!0}))};try{e=f.apply(this,t)}finally{Object.defineProperty=n}}else e=f.apply(this,t);return e}}var p=jasmine.QueueRunner;jasmine.QueueRunner=function(n){function r(r){var o,a=this;r.onComplete&&(r.onComplete=(o=r.onComplete,function(){a.testProxyZone=null,a.testProxyZoneSpec=null,i.scheduleMicroTask("jasmine.onComplete",o)}));var s=e[t.__symbol__("setTimeout")],c=e[t.__symbol__("clearTimeout")];s&&(r.timeout={setTimeout:s||e.setTimeout,clearTimeout:c||e.clearTimeout}),jasmine.UserContext?(r.userContext||(r.userContext=new jasmine.UserContext),r.userContext.queueRunner=this):(r.userContext||(r.userContext={}),r.userContext.queueRunner=this);var u=r.onException;r.onException=function(e){if(e&&"Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."===e.message){var t=this&&this.testProxyZoneSpec;if(t){var n=t.getAndClearPendingTasksInfo();try{e.message+=n}catch(e){}}}u&&u.call(this,e)},n.call(this,r)}return function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);function r(){this.constructor=e}e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,n),r.prototype.execute=function(){for(var e=this,r=t.current,a=!1;r;){if(r===i){a=!0;break}r=r.parent}if(!a)throw new Error("Unexpected Zone: "+t.current.name);this.testProxyZoneSpec=new o,this.testProxyZone=i.fork(this.testProxyZoneSpec),t.currentTask?n.prototype.execute.call(this):t.current.scheduleMicroTask("jasmine.execute().forceTask",(function(){return p.prototype.execute.call(e)}))},r}(p)}function d(e,n,r,o){var i=!!jasmine[a("clockInstalled")],s=r.testProxyZone;if(i&&c){var u=t[t.__symbol__("fakeAsyncTest")];u&&"function"==typeof u.fakeAsync&&(e=u.fakeAsync(e))}return o?s.run(e,n,[o]):s.run(e,n)}function y(e){return e&&(e.length?function(t){return d(e,this,this.queueRunner,t)}:function(){return d(e,this,this.queueRunner)})}})),Zone.__load_patch("jest",(function(e,t,n){if("undefined"!=typeof jest&&!jest.__zone_patch__){t[n.symbol("ignoreConsoleErrorUncaughtError")]=!0,jest.__zone_patch__=!0;var r=t.ProxyZoneSpec,o=t.SyncTestZoneSpec;if(!r)throw new Error("Missing ProxyZoneSpec");var i=t.current,a=i.fork(new o("jest.describe")),s=new r,c=i.fork(s);["describe","xdescribe","fdescribe"].forEach((function(n){var r=e[n];e[t.__symbol__(n)]||(e[t.__symbol__(n)]=r,e[n]=function(){for(var e=[],t=0;t0},n.prototype._finishCallbackIfDone=function(){var e=this;null!==this._existingFinishTimer&&(clearTimeout(this._existingFinishTimer),this._existingFinishTimer=null),this._pendingMicroTasks||this._pendingMacroTasks||this.supportWaitUnresolvedChainedPromise&&this.isUnresolvedChainedPromisePending()||this.runZone.run((function(){e._existingFinishTimer=setTimeout((function(){e._alreadyErrored||e._pendingMicroTasks||e._pendingMacroTasks||e.finishCallback()}),0)}))},n.prototype.patchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("patchPromiseForTest")];e&&e()}},n.prototype.unPatchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("unPatchPromiseForTest")];e&&e()}},n.prototype.onScheduleTask=function(e,n,r,o){return"eventTask"!==o.type&&(this._isSync=!1),"microTask"===o.type&&o.data&&o.data instanceof Promise&&!0===o.data[t.symbolParentUnresolved]&&this.unresolvedChainedPromiseCount--,e.scheduleTask(r,o)},n.prototype.onInvokeTask=function(e,t,n,r,o,i){return"eventTask"!==r.type&&(this._isSync=!1),e.invokeTask(n,r,o,i)},n.prototype.onCancelTask=function(e,t,n,r){return"eventTask"!==r.type&&(this._isSync=!1),e.cancelTask(n,r)},n.prototype.onInvoke=function(e,t,n,r,o,i,a){this.entryFunction||(this.entryFunction=r);try{return this._isSync=!0,e.invoke(n,r,o,i,a)}finally{this._isSync&&this.entryFunction===r&&this._finishCallbackIfDone()}},n.prototype.onHandleError=function(e,t,n,r){return e.handleError(n,r)&&(this.failCallback(r),this._alreadyErrored=!0),!1},n.prototype.onHasTask=function(e,t,n,r){e.hasTask(n,r),t===n&&("microTask"==r.change?(this._pendingMicroTasks=r.microTask,this._finishCallbackIfDone()):"macroTask"==r.change&&(this._pendingMacroTasks=r.macroTask,this._finishCallbackIfDone()))},n}();(t=n).symbolParentUnresolved=Zone.__symbol__("parentUnresolved"),Zone.AsyncTestZoneSpec=n}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global),Zone.__load_patch("asynctest",(function(e,t,n){function r(e,n,r,o){var i=t.current,a=t.AsyncTestZoneSpec;if(void 0===a)throw new Error("AsyncTestZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/plugins/async-test");var s=t.ProxyZoneSpec;if(!s)throw new Error("ProxyZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/plugins/proxy");var c=s.get();s.assertPresent();var u=t.current.getZoneWith("ProxyZoneSpec"),l=c.getDelegate();return u.parent.run((function(){var e=new a((function(){c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),i.run((function(){r()}))}),(function(t){c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),i.run((function(){o(t)}))}),"test");c.setDelegate(e),e.patchPromiseForTest()})),t.current.runGuarded(e,n)}t[n.symbol("asyncTest")]=function t(n){return e.jasmine?function(e){e||((e=function(){}).fail=function(e){throw e}),r(n,this,e,(function(t){if("string"==typeof t)return e.fail(new Error(t));e.fail(t)}))}:function(){var e=this;return new Promise((function(t,o){r(n,e,t,o)}))}}})),function(e){var t,n=e.Date;function r(){if(0===arguments.length){var e=new n;return e.setTime(r.now()),e}var t=Array.prototype.slice.call(arguments);return new(n.bind.apply(n,__spreadArray([void 0],t,!1)))}r.now=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.getFakeSystemTime():n.now.apply(this,arguments)},r.UTC=n.UTC,r.parse=n.parse;var o={setTimeout:e.setTimeout,setInterval:e.setInterval,clearTimeout:e.clearTimeout,clearInterval:e.clearInterval},i=function(){function r(){this._schedulerQueue=[],this._currentTickTime=0,this._currentFakeBaseSystemTime=n.now(),this._currentTickRequeuePeriodicEntries=[]}return r.prototype.getCurrentTickTime=function(){return this._currentTickTime},r.prototype.getFakeSystemTime=function(){return this._currentFakeBaseSystemTime+this._currentTickTime},r.prototype.setFakeBaseSystemTime=function(e){this._currentFakeBaseSystemTime=e},r.prototype.getRealSystemTime=function(){return n.now()},r.prototype.scheduleFunction=function(e,n,r){var o=(r=__assign({args:[],isPeriodic:!1,isRequestAnimationFrame:!1,id:-1,isRequeuePeriodic:!1},r)).id<0?t.nextId++:r.id,i={endTime:this._currentTickTime+n,id:o,func:e,args:r.args,delay:n,isPeriodic:r.isPeriodic,isRequestAnimationFrame:r.isRequestAnimationFrame};r.isRequeuePeriodic&&this._currentTickRequeuePeriodicEntries.push(i);for(var a=0;a0&&(this._currentTickRequeuePeriodicEntries=[],!(o=0&&this._schedulerQueue.splice(c,1)}if(i=this._currentTickTime,this._currentTickTime=s.endTime,n&&n(this._currentTickTime-i),!s.func.apply(e,s.isRequestAnimationFrame?[this._currentTickTime]:s.args))break;r.processNewMacroTasksSynchronously||this._currentTickRequeuePeriodicEntries.forEach((function(e){for(var t=0;t0;){if(++i>t)throw new Error("flush failed after reaching the limit of "+t+" tasks. Does your code use a polling timeout?");if(0===this._schedulerQueue.filter((function(e){return!e.isPeriodic&&!e.isRequestAnimationFrame})).length)break;var a=this._schedulerQueue.shift();if(o=this._currentTickTime,this._currentTickTime=a.endTime,n&&n(this._currentTickTime-o),!a.func.apply(e,a.args))break}return this._currentTickTime-r},r}();(t=i).nextId=1;var a=function(){function t(t,n,r){void 0===n&&(n=!1),this.trackPendingRequestAnimationFrame=n,this.macroTaskOptions=r,this._scheduler=new i,this._microtasks=[],this._lastError=null,this._uncaughtPromiseErrors=Promise[Zone.__symbol__("uncaughtPromiseErrors")],this.pendingPeriodicTimers=[],this.pendingTimers=[],this.patchDateLocked=!1,this.properties={FakeAsyncTestZoneSpec:this},this.name="fakeAsyncTestZone for "+t,this.macroTaskOptions||(this.macroTaskOptions=e[Zone.__symbol__("FakeAsyncTestMacroTask")])}return t.assertInZone=function(){if(null==Zone.current.get("FakeAsyncTestZoneSpec"))throw new Error("The code should be running in the fakeAsync zone to call this function")},t.prototype._fnAndFlush=function(t,n){var r=this;return function(){for(var o=[],i=0;i-1&&e.splice(n,1)},t.prototype._dequeueTimer=function(e){var n=this;return function(){t._removeTimer(n.pendingTimers,e)}},t.prototype._requeuePeriodicTimer=function(e,t,n,r){var o=this;return function(){-1!==o.pendingPeriodicTimers.indexOf(r)&&o._scheduler.scheduleFunction(e,t,{args:n,isPeriodic:!0,id:r,isRequeuePeriodic:!0})}},t.prototype._dequeuePeriodicTimer=function(e){var n=this;return function(){t._removeTimer(n.pendingPeriodicTimers,e)}},t.prototype._setTimeout=function(e,t,n,r){void 0===r&&(r=!0);var o=this._dequeueTimer(i.nextId),a=this._fnAndFlush(e,{onSuccess:o,onError:o}),s=this._scheduler.scheduleFunction(a,t,{args:n,isRequestAnimationFrame:!r});return r&&this.pendingTimers.push(s),s},t.prototype._clearTimeout=function(e){t._removeTimer(this.pendingTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},t.prototype._setInterval=function(e,t,n){var r=i.nextId,o={onSuccess:null,onError:this._dequeuePeriodicTimer(r)},a=this._fnAndFlush(e,o);return o.onSuccess=this._requeuePeriodicTimer(a,t,n,r),this._scheduler.scheduleFunction(a,t,{args:n,isPeriodic:!0}),this.pendingPeriodicTimers.push(r),r},t.prototype._clearInterval=function(e){t._removeTimer(this.pendingPeriodicTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},t.prototype._resetLastErrorAndThrow=function(){var e=this._lastError||this._uncaughtPromiseErrors[0];throw this._uncaughtPromiseErrors.length=0,this._lastError=null,e},t.prototype.getCurrentTickTime=function(){return this._scheduler.getCurrentTickTime()},t.prototype.getFakeSystemTime=function(){return this._scheduler.getFakeSystemTime()},t.prototype.setFakeBaseSystemTime=function(e){this._scheduler.setFakeBaseSystemTime(e)},t.prototype.getRealSystemTime=function(){return this._scheduler.getRealSystemTime()},t.patchDate=function(){e[Zone.__symbol__("disableDatePatching")]||e.Date!==r&&(e.Date=r,r.prototype=n.prototype,t.checkTimerPatch())},t.resetDate=function(){e.Date===r&&(e.Date=n)},t.checkTimerPatch=function(){e.setTimeout!==o.setTimeout&&(e.setTimeout=o.setTimeout,e.clearTimeout=o.clearTimeout),e.setInterval!==o.setInterval&&(e.setInterval=o.setInterval,e.clearInterval=o.clearInterval)},t.prototype.lockDatePatch=function(){this.patchDateLocked=!0,t.patchDate()},t.prototype.unlockDatePatch=function(){this.patchDateLocked=!1,t.resetDate()},t.prototype.tickToNext=function(e,n,r){void 0===e&&(e=1),void 0===r&&(r={processNewMacroTasksSynchronously:!0}),e<=0||(t.assertInZone(),this.flushMicrotasks(),this._scheduler.tickToNext(e,n,r),null!==this._lastError&&this._resetLastErrorAndThrow())},t.prototype.tick=function(e,n,r){void 0===e&&(e=0),void 0===r&&(r={processNewMacroTasksSynchronously:!0}),t.assertInZone(),this.flushMicrotasks(),this._scheduler.tick(e,n,r),null!==this._lastError&&this._resetLastErrorAndThrow()},t.prototype.flushMicrotasks=function(){var e=this;for(t.assertInZone();this._microtasks.length>0;){var n=this._microtasks.shift();n.func.apply(n.target,n.args)}(null!==e._lastError||e._uncaughtPromiseErrors.length)&&e._resetLastErrorAndThrow()},t.prototype.flush=function(e,n,r){t.assertInZone(),this.flushMicrotasks();var o=this._scheduler.flush(e,n,r);return null!==this._lastError&&this._resetLastErrorAndThrow(),o},t.prototype.flushOnlyPendingTimers=function(e){t.assertInZone(),this.flushMicrotasks();var n=this._scheduler.flushOnlyPendingTimers(e);return null!==this._lastError&&this._resetLastErrorAndThrow(),n},t.prototype.removeAllTimers=function(){t.assertInZone(),this._scheduler.removeAll(),this.pendingPeriodicTimers=[],this.pendingTimers=[]},t.prototype.getTimerCount=function(){return this._scheduler.getTimerCount()+this._microtasks.length},t.prototype.onScheduleTask=function(e,t,n,r){switch(r.type){case"microTask":var o=r.data&&r.data.args,i=void 0;if(o){var a=r.data.cbIdx;"number"==typeof o.length&&o.length>a+1&&(i=Array.prototype.slice.call(o,a+1))}this._microtasks.push({func:r.invoke,args:i,target:r.data&&r.data.target});break;case"macroTask":switch(r.source){case"setTimeout":r.data.handleId=this._setTimeout(r.invoke,r.data.delay,Array.prototype.slice.call(r.data.args,2));break;case"setImmediate":r.data.handleId=this._setTimeout(r.invoke,0,Array.prototype.slice.call(r.data.args,1));break;case"setInterval":r.data.handleId=this._setInterval(r.invoke,r.data.delay,Array.prototype.slice.call(r.data.args,2));break;case"XMLHttpRequest.send":throw new Error("Cannot make XHRs from within a fake async test. Request URL: "+r.data.url);case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":r.data.handleId=this._setTimeout(r.invoke,16,r.data.args,this.trackPendingRequestAnimationFrame);break;default:var s=this.findMacroTaskOption(r);if(s){var c=r.data&&r.data.args,u=c&&c.length>1?c[1]:0,l=s.callbackArgs?s.callbackArgs:c;s.isPeriodic?(r.data.handleId=this._setInterval(r.invoke,u,l),r.data.isPeriodic=!0):r.data.handleId=this._setTimeout(r.invoke,u,l);break}throw new Error("Unknown macroTask scheduled in fake async test: "+r.source)}break;case"eventTask":r=e.scheduleTask(n,r)}return r},t.prototype.onCancelTask=function(e,t,n,r){switch(r.source){case"setTimeout":case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":return this._clearTimeout(r.data.handleId);case"setInterval":return this._clearInterval(r.data.handleId);default:var o=this.findMacroTaskOption(r);if(o){var i=r.data.handleId;return o.isPeriodic?this._clearInterval(i):this._clearTimeout(i)}return e.cancelTask(n,r)}},t.prototype.onInvoke=function(e,n,r,o,i,a,s){try{return t.patchDate(),e.invoke(r,o,i,a,s)}finally{this.patchDateLocked||t.resetDate()}},t.prototype.findMacroTaskOption=function(e){if(!this.macroTaskOptions)return null;for(var t=0;t0)throw new Error("".concat(i.pendingPeriodicTimers.length," ")+"periodic timer(s) still in the queue.");if(i.pendingTimers.length>0)throw new Error("".concat(i.pendingTimers.length," timer(s) still in the queue."));return h}finally{a()}};return n.isFakeAsync=!0,n}}}),!0),Zone.__load_patch("promisefortest",(function(e,t,n){var r=n.symbol("state"),o=n.symbol("parentUnresolved");Promise[n.symbol("patchPromiseForTest")]=function e(){var n=Promise[t.__symbol__("ZonePromiseThen")];n||(n=Promise[t.__symbol__("ZonePromiseThen")]=Promise.prototype.then,Promise.prototype.then=function(){var e=n.apply(this,arguments);if(null===this[r]){var i=t.current.get("AsyncTestZoneSpec");i&&(i.unresolvedChainedPromiseCount++,e[o]=!0)}return e})},Promise[n.symbol("unPatchPromiseForTest")]=function e(){var n=Promise[t.__symbol__("ZonePromiseThen")];n&&(Promise.prototype.then=n,Promise[t.__symbol__("ZonePromiseThen")]=void 0)}}))}));