@angular/upgrade
Version:
Angular - the library for easing update from v1 to v2
72 lines (70 loc) • 27.2 kB
JavaScript
/**
* @license Angular v11.2.4
* (c) 2010-2021 Google LLC. https://angular.io/
* License: MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/platform-browser-dynamic")):"function"==typeof define&&define.amd?define("@angular/upgrade",["exports","@angular/core","@angular/platform-browser-dynamic"],e):e(((t=t||self).ng=t.ng||{},t.ng.upgrade={}),t.ng.core,t.ng.platformBrowserDynamic)}(this,(function(t,e,n){"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/var r=new e.Version("11.2.4"),o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function i(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function a(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s(arguments[e]));return t}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
function c(){throw new Error("AngularJS v1.x is not loaded!")}var u=function(){return c()};u.cleanData=c;var p={bootstrap:c,module:c,element:u,injector:c,version:void 0,resumeBootstrap:c,getTestability:c};try{window.hasOwnProperty("angular")&&(p=window.angular)}catch(t){}var l=function(t){return p.element(t)};l.cleanData=function(t){return p.element.cleanData(t)};var h="$$angularInjector",d=function(){function t(t,e){this.prop=t,this.attr=e,this.parseBinding()}return t.prototype.parseBinding=function(){this.bracketAttr="["+this.attr+"]",this.parenAttr="("+this.attr+")",this.bracketParenAttr="[("+this.attr+")]";var t=this.attr.charAt(0).toUpperCase()+this.attr.substr(1);this.onAttr="on"+t,this.bindAttr="bind"+t,this.bindonAttr="bindon"+t},t}(),f=/^(?:x|data)[:\-_]/i,g=/[:\-_]+(.)/g;function m(t){throw console.error?console.error(t,t.stack):console.log(t,t.stack),t}function y(t){l.cleanData([t]),function e(t){return j(t.querySelectorAll)}(t)&&l.cleanData(t.querySelectorAll("*"))}function v(t){return"$"+t+"Controller"}function w(t){return t.overriddenName||t.name||t.toString().split("\n")[0]}function b(t){return t.has("$$angularDowngradedModuleCount")?t.get("$$angularDowngradedModuleCount"):0}function $(t){return t.has("$$angularUpgradeAppType")?t.get("$$angularUpgradeAppType"):0}function j(t){return"function"==typeof t}function C(t,e,n,r){var o=$(t),i=b(t);switch(o){case 1:case 2:if(e)throw new Error("Error while "+r+": 'downgradedModule' unexpectedly specified.\nYou should not specify a value for 'downgradedModule', unless you are downgrading more than one Angular module (via 'downgradeModule()').");break;case 3:if(!e&&i>=2)throw new Error("Error while "+r+": 'downgradedModule' not specified.\nThis application contains more than one downgraded Angular module, thus you need to always specify 'downgradedModule' when downgrading components and injectables.");if(!t.has(n))throw new Error("Error while "+r+": Unable to find the specified downgraded module.\nDid you forget to downgrade an Angular module or include it in the AngularJS application?");break;default:throw new Error("Error while "+r+": Not a valid '@angular/upgrade' application.\nDid you forget to downgrade an Angular module or include it in the AngularJS application?")}}var O=function O(){var t=this;this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))};function E(t,e){return t===e||t!=t&&e!=e}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/var A,k={__UNINITIALIZED__:!0},R=function(){function t(t,e,n,r,o,i,s,a,c){this.element=t,this.attrs=e,this.scope=n,this.ngModel=r,this.parentInjector=o,this.$compile=i,this.$parse=s,this.componentFactory=a,this.wrapCallback=c,this.implementsOnChanges=!1,this.inputChangeCount=0,this.inputChanges={},this.componentScope=n.$new()}return t.prototype.compileContents=function(){var t=this,e=[],n=this.groupProjectableNodes().map((function(e){return t.$compile(e)}));return this.element.empty(),n.forEach((function(n){n(t.scope,(function(n){e.push(n),t.element.append(n)}))})),e},t.prototype.createComponent=function(t){var n=e.Injector.create({providers:[{provide:"$scope",useValue:this.componentScope}],parent:this.parentInjector,name:"DowngradeComponentAdapter"});this.componentRef=this.componentFactory.create(n,t,this.element[0]),this.viewChangeDetector=this.componentRef.injector.get(e.ChangeDetectorRef),this.changeDetector=this.componentRef.changeDetectorRef,this.component=this.componentRef.instance;var r=this.componentRef.injector.get(e.Testability,null);r&&this.componentRef.injector.get(e.TestabilityRegistry).registerApplication(this.componentRef.location.nativeElement,r),function o(t,e){t&&function n(t){return"function"==typeof t.writeValue&&"function"==typeof t.registerOnChange}(e)&&(t.$render=function(){e.writeValue(t.$viewValue)},e.registerOnChange(t.$setViewValue.bind(t)),"function"==typeof e.registerOnTouched&&e.registerOnTouched(t.$setTouched.bind(t)))}(this.ngModel,this.component)},t.prototype.setupInputs=function(t,n){var r=this;void 0===n&&(n=!0);for(var o=this.attrs,i=this.componentFactory.inputs||[],s=function(t){var e,n,s=new d(i[t].propName,i[t].templateName),c=null;if(o.hasOwnProperty(s.attr)){var u=(e=s.prop,n=k,function(t){E(n,t)||(n===k&&(n=t),r.updateInput(e,n,t),n=t)});o.$observe(s.attr,u);var p=a.componentScope.$watch((function(){p(),p=null,u(o[s.attr])}))}else o.hasOwnProperty(s.bindAttr)?c=o[s.bindAttr]:o.hasOwnProperty(s.bracketAttr)?c=o[s.bracketAttr]:o.hasOwnProperty(s.bindonAttr)?c=o[s.bindonAttr]:o.hasOwnProperty(s.bracketParenAttr)&&(c=o[s.bracketParenAttr]);if(null!=c){var l=function(t){return function(e,n){return r.updateInput(t,n,e)}}(s.prop);a.componentScope.$watch(c,l)}},a=this,c=0;c<i.length;c++)s(c);var u=function(){return r.changeDetector.detectChanges()},p=this.componentFactory.componentType.prototype;if(this.implementsOnChanges=!(!p||!p.ngOnChanges),this.componentScope.$watch((function(){return r.inputChangeCount}),this.wrapCallback((function(){if(r.implementsOnChanges){var t=r.inputChanges;r.inputChanges={},r.component.ngOnChanges(t)}r.viewChangeDetector.markForCheck(),n||u()}))),n&&this.componentScope.$watch(this.wrapCallback(u)),t||!n)var l=this.componentScope.$watch((function(){l(),l=null,r.parentInjector.get(e.ApplicationRef).attachView(r.componentRef.hostView)}))},t.prototype.setupOutputs=function(){for(var t=this.attrs,e=this.componentFactory.outputs||[],n=0;n<e.length;n++){var r=new d(e[n].propName,e[n].templateName),o=r.bindonAttr.substring(0,r.bindonAttr.length-6),i="[("+r.bracketParenAttr.substring(2,r.bracketParenAttr.length-8)+")]";t.hasOwnProperty(o)&&this.subscribeToOutput(r,t[o],!0),t.hasOwnProperty(i)&&this.subscribeToOutput(r,t[i],!0),t.hasOwnProperty(r.onAttr)&&this.subscribeToOutput(r,t[r.onAttr]),t.hasOwnProperty(r.parenAttr)&&this.subscribeToOutput(r,t[r.parenAttr])}},t.prototype.subscribeToOutput=function(t,e,n){var r=this;void 0===n&&(n=!1);var o=this.$parse(e),i=o.assign;if(n&&!i)throw new Error("Expression '"+e+"' is not assignable!");var s=this.component[t.prop];if(!s)throw new Error("Missing emitter '"+t.prop+"' on component '"+w(this.componentFactory.componentType)+"'!");s.subscribe({next:n?function(t){return i(r.scope,t)}:function(t){return o(r.scope,{$event:t})}})},t.prototype.registerCleanup=function(){var t=this,n=this.componentRef.injector.get(e.TestabilityRegistry),r=this.wrapCallback((function(){return t.componentRef.destroy()})),o=!1;this.element.on("$destroy",(function(){o||t.componentScope.$destroy()})),this.componentScope.$on("$destroy",(function(){o||(o=!0,n.unregisterApplication(t.componentRef.location.nativeElement),y(t.element[0]),r())}))},t.prototype.getInjector=function(){return this.componentRef.injector},t.prototype.updateInput=function(t,n,r){this.implementsOnChanges&&(this.inputChanges[t]=new e.SimpleChange(n,r,n===r)),this.inputChangeCount++,this.component[t]=r},t.prototype.groupProjectableNodes=function(){return function t(e,n){for(var r=[],o=0,i=e.length;o<i;++o)r[o]=[];for(var s=0,a=n.length;s<a;++s){var c=n[s],u=T(c,e);null!=u&&r[u].push(c)}return r}(this.componentFactory.ngContentSelectors,this.element.contents())},t}();function T(t,e){for(var n=[],r=-1,o=0;o<e.length;o++){var i=e[o];"*"===i?r=o:P(t,i)&&n.push(o)}return n.sort(),-1!==r&&n.push(r),n.length?n[0]:null}function P(t,e){if(!A){var n=Element.prototype;A=n.matches||n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}return t.nodeType===Node.ELEMENT_NODE&&A.call(t,e)}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/var D=function(){function t(){this.resolved=!1,this.callbacks=[]}return t.all=function(e){var n=new t,r=0,o=[],i=function(t,i){o[t]=i,++r===e.length&&n.resolve(o)};return e.forEach((function(t,e){!function n(t){return!!t&&j(t.then)}(t)?i(e,t):t.then((function(t){return i(e,t)}))})),n},t.prototype.resolve=function(t){this.resolved||(this.value=t,this.resolved=!0,this.callbacks.forEach((function(e){return e(t)})),this.callbacks.length=0)},t.prototype.then=function(t){this.resolved?t(this.value):this.callbacks.push(t)},t}(),S=function(t){function e(e){var n=t.call(this)||this;return n.element=e,n.injectorKey=v(h),e.data(n.injectorKey,n),n}return i(e,t),e.prototype.resolve=function(e){this.element.data(this.injectorKey,e),this.element=null,t.prototype.resolve.call(this,e)},e}(D),I=/^(\^\^?)?(\?)?(\^\^?)?/,M=function(){function t(e,n,r,o){this.name=n,this.$injector=e.get("$injector"),this.$compile=this.$injector.get("$compile"),this.$controller=this.$injector.get("$controller"),this.element=r.nativeElement,this.$element=l(this.element),this.directive=o||t.getDirective(this.$injector,n)}return t.getDirective=function(t,e){var n=t.get(e+"Directive");if(n.length>1)throw new Error("Only support single directive definition for: "+e);var r=n[0];return r.compile&&!r.link&&B(e,"compile"),r.replace&&B(e,"replace"),r.terminal&&B(e,"terminal"),r},t.getTemplate=function(t,e,n,r){if(void 0===n&&(n=!1),void 0!==e.template)return N(e.template,r);if(e.templateUrl){var o=t.get("$templateCache"),i=N(e.templateUrl,r),s=o.get(i);if(void 0!==s)return s;if(!n)throw new Error("loading directive templates asynchronously is not supported");return new Promise((function(e,n){t.get("$httpBackend")("GET",i,null,(function(t,r){200===t?e(o.put(i,r)):n("GET component template from '"+i+"' returned '"+t+": "+r+"'")}))}))}throw new Error("Directive '"+e.name+"' is not a component, it is missing template.")},t.prototype.buildController=function(t,e){var n=this.$controller(t,{$scope:e,$element:this.$element},null,this.directive.controllerAs);return this.$element.data(v(this.directive.name),n),n},t.prototype.compileTemplate=function(e){return void 0===e&&(e=t.getTemplate(this.$injector,this.directive,!1,this.$element)),this.compileHtml(e)},t.prototype.onDestroy=function(t,e){e&&j(e.$onDestroy)&&e.$onDestroy(),t.$destroy(),y(this.element)},t.prototype.prepareTransclusion=function(){var t=this,e=this.directive.transclude,n=this.extractChildNodes(),r=function(t,e){return e(o,t=t||{$destroy:function(){}})},o=n;if(e){var i=Object.create(null);if("object"==typeof e){o=[];var s=Object.create(null),a=Object.create(null);Object.keys(e).forEach((function(t){var n=e[t],r="?"===n.charAt(0);n=r?n.substring(1):n,s[n]=t,i[t]=null,a[t]=r})),n.forEach((function(t){var e=s[function n(t){return t.replace(f,"").replace(g,(function(t,e){return e.toUpperCase()}))}(t.nodeName.toLowerCase())];e?(a[e]=!0,i[e]=i[e]||[],i[e].push(t)):o.push(t)})),Object.keys(a).forEach((function(e){if(!a[e])throw new Error("Required transclusion slot '"+e+"' on directive: "+t.name)})),Object.keys(i).filter((function(t){return i[t]})).forEach((function(t){var e=i[t];i[t]=function(t,n){return n(e,t)}}))}r.$$slots=i,o.forEach((function(t){t.nodeType!==Node.TEXT_NODE||t.nodeValue||(t.nodeValue="")}))}return r},t.prototype.resolveAndBindRequiredControllers=function(t){var e=this.getDirectiveRequire(),n=this.resolveRequire(e);if(t&&this.directive.bindToController&&_(e)){var r=n;Object.keys(r).forEach((function(e){t[e]=r[e]}))}return n},t.prototype.compileHtml=function(t){return this.element.innerHTML=t,this.$compile(this.element.childNodes)},t.prototype.extractChildNodes=function(){for(var t,e=[];t=this.element.firstChild;)this.element.removeChild(t),e.push(t);return e},t.prototype.getDirectiveRequire=function(){var t=this.directive.require||this.directive.controller&&this.directive.name;return _(t)&&Object.keys(t).forEach((function(e){var n=t[e],r=n.match(I);n.substring(r[0].length)||(t[e]=r[0]+e)})),t},t.prototype.resolveRequire=function(t,e){var n=this;if(t){if(Array.isArray(t))return t.map((function(t){return n.resolveRequire(t)}));if("object"==typeof t){var r={};return Object.keys(t).forEach((function(e){return r[e]=n.resolveRequire(t[e])})),r}if("string"==typeof t){var o=t.match(I),i=o[1]||o[3],s=t.substring(o[0].length),a=!!o[2],c=!!i,u="^^"===i,p=v(s),l=u?this.$element.parent():this.$element,h=c?l.inheritedData(p):l.data(p);if(!h&&!a)throw new Error("Unable to find required '"+t+"' in upgraded directive '"+this.name+"'.");return h}throw new Error("Unrecognized 'require' syntax on upgraded directive '"+this.name+"': "+t)}return null},t}();function N(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return j(t)?t.apply(void 0,a(e)):t}function _(t){return t&&!Array.isArray(t)&&"object"==typeof t}function B(t,e){throw new Error("Upgraded directive '"+t+"' contains unsupported feature: '"+e+"'.")}var U=/([A-Z])/g,F={__UNINITIALIZED__:!0},x=function(){function t(t){this.name=t,this.inputs=[],this.inputsRename=[],this.outputs=[],this.outputsRename=[],this.propertyOutputs=[],this.checkProperties=[],this.propertyMap={},this.directive=null;var n=t.replace(U,(function(t,e){return"-"+e.toLowerCase()})),r=this,o={selector:n,inputs:this.inputsRename,outputs:this.outputsRename},s=function(e){function n(n,o,i){return e.call(this,new M(o,t,i,r.directive||void 0),n,r.template,r.inputs,r.outputs,r.propertyOutputs,r.checkProperties,r.propertyMap)||this}return i(n,e),n}(Z);s.decorators=[{type:e.Directive,args:[Object.assign({jit:!0},o)]}],s.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:["$scope"]}]},{type:e.Injector},{type:e.ElementRef}]},this.type=s}return t.prototype.extractBindings=function(){var t=this,e="object"==typeof this.directive.bindToController;if(e&&Object.keys(this.directive.scope).length)throw new Error("Binding definitions on scope and controller at the same time are not supported.");var n=e?this.directive.bindToController:this.directive.scope;"object"==typeof n&&Object.keys(n).forEach((function(e){var r=n[e],o=r.charAt(0),i=r.charAt(1),s=r.substring("?"===i?2:1)||e,a="input_"+s,c=a+": "+s,u="output_"+s,p=u+": "+s,l=p+"Change";switch(o){case"@":case"<":t.inputs.push(a),t.inputsRename.push(c),t.propertyMap[a]=e;break;case"=":t.inputs.push(a),t.inputsRename.push(c),t.propertyMap[a]=e,t.outputs.push(u),t.outputsRename.push(l),t.propertyMap[u]=e,t.checkProperties.push(e),t.propertyOutputs.push(u);break;case"&":t.outputs.push(u),t.outputsRename.push(p),t.propertyMap[u]=e;break;default:var h=JSON.stringify(n);throw new Error("Unexpected mapping '"+o+"' in '"+h+"' in '"+t.name+"' directive.")}}))},t.resolve=function(t,e){var n=Object.keys(t).map((function(n){var r=t[n];return r.directive=M.getDirective(e,n),r.extractBindings(),Promise.resolve(M.getTemplate(e,r.directive,!0)).then((function(t){return r.template=t}))}));return Promise.all(n)},t}(),Z=function(){function t(t,n,r,o,i,s,a,c){this.helper=t,this.template=r,this.inputs=o,this.outputs=i,this.propOuts=s,this.checkProperties=a,this.propertyMap=c,this.controllerInstance=null,this.destinationObj=null,this.checkLastValues=[],this.$element=null,this.directive=t.directive,this.element=t.element,this.$element=t.$element,this.componentScope=n.$new(!!this.directive.scope);var u=this.directive.controller;this.directive.bindToController&&u?(this.controllerInstance=this.helper.buildController(u,this.componentScope),this.destinationObj=this.controllerInstance):this.destinationObj=this.componentScope;for(var p=0;p<o.length;p++)this[o[p]]=null;for(var l=0;l<i.length;l++){var h=this[i[l]]=new e.EventEmitter;-1===this.propOuts.indexOf(i[l])&&this.setComponentProperty(i[l],function(t){return function(e){return t.emit(e)}}(h))}for(var d=0;d<s.length;d++)this.checkLastValues.push(F)}return t.prototype.ngOnInit=function(){var t=this.helper.prepareTransclusion(),e=this.helper.compileTemplate(this.template),n=this.directive.controller;n&&!this.directive.bindToController&&(this.controllerInstance=this.helper.buildController(n,this.componentScope));var r=this.helper.resolveAndBindRequiredControllers(this.controllerInstance);this.controllerInstance&&j(this.controllerInstance.$onInit)&&this.controllerInstance.$onInit();var o=this.directive.link,i="object"==typeof o&&o.pre,s="object"==typeof o?o.post:o;i&&i(this.componentScope,this.$element,"NOT_SUPPORTED",r,"NOT_SUPPORTED"),e(this.componentScope,null,{parentBoundTranscludeFn:t}),s&&s(this.componentScope,this.$element,"NOT_SUPPORTED",r,"NOT_SUPPORTED"),this.controllerInstance&&j(this.controllerInstance.$postLink)&&this.controllerInstance.$postLink()},t.prototype.ngOnChanges=function(t){var e=this,n={};Object.keys(t).forEach((function(r){var o=t[r];e.setComponentProperty(r,o.currentValue),n[e.propertyMap[r]]=o})),j(this.destinationObj.$onChanges)&&this.destinationObj.$onChanges(n)},t.prototype.ngDoCheck=function(){var t=this,e=this.destinationObj,n=this.checkLastValues,r=this.propOuts;this.checkProperties.forEach((function(o,i){var s=e[o];E(n[i],s)||t[r[i]].emit(n[i]=s)})),this.controllerInstance&&j(this.controllerInstance.$doCheck)&&this.controllerInstance.$doCheck()},t.prototype.ngOnDestroy=function(){this.helper.onDestroy(this.componentScope,this.controllerInstance)},t.prototype.setComponentProperty=function(t,e){this.destinationObj[this.propertyMap[t]]=e},t}();Z.decorators=[{type:e.Directive}],Z.ctorParameters=function(){return[{type:M},{type:void 0},{type:String},{type:Array},{type:Array},{type:Array},{type:Array},{type:void 0}]};var q=0,L=function(){function t(t,e){if(this.ng2AppModule=t,this.compilerOptions=e,this.idPrefix="NG2_UPGRADE_"+q+++"_",this.downgradedComponents=[],this.ng1ComponentsToBeUpgraded={},this.upgradedProviders=[],this.moduleRef=null,!t)throw new Error("UpgradeAdapter cannot be instantiated without an NgModule of the Angular app.")}return t.prototype.downgradeNg2Component=function(t){return this.downgradedComponents.push(t),function n(t){var n=function(n,r,o){var i,a=3===$(r),c=a?function(t){return function(){return e.NgZone.isInAngularZone()?t():i.run(t)}}:function(t){return t},u=a&&b(r)>1;return{restrict:"E",terminal:!0,require:["?^^$$angularInjector","?ngModel"],link:function(p,l,h,d){var f=d[1],g=d[0],m=void 0,y=!1;if(!g||u){var v=t.downgradedModule||"",b="$$angularLazyModuleRef"+v,$="instantiating component '"+w(t.component)+"'";C(r,v,b,$);var j=r.get(b);m=j.injector||j.promise}var O=function(r,i){var s=i.get(e.ComponentFactoryResolver).resolveComponentFactory(t.component);if(!s)throw new Error("Expecting ComponentFactory for: "+w(t.component));var u=new S(l),d=new R(l,h,p,f,r,n,o,s,c),g=d.compileContents();d.createComponent(g),d.setupInputs(a,t.propagateDigest),d.setupOutputs(),d.registerCleanup(),u.resolve(d.getInjector()),y&&p.$evalAsync((function(){}))},E=a?function(t,n){i||(i=t.get(e.NgZone)),c((function(){return O(t,n)}))()}:O;D.all([g||m,m||g]).then((function(t){var e=s(t,2);return E(e[0],e[1])})),y=!0}}};return n.$inject=["$compile","$injector","$parse"],n}({component:t})},t.prototype.upgradeNg1Component=function(t){return this.ng1ComponentsToBeUpgraded.hasOwnProperty(t)?this.ng1ComponentsToBeUpgraded[t].type:(this.ng1ComponentsToBeUpgraded[t]=new x(t)).type},t.prototype.registerForNg1Tests=function(t){var e=this,n=window.angular.mock;if(!n||!n.module)throw new Error("Failed to find 'angular.mock.module'.");this.declareNg1Module(t),n.module(this.ng1Module.name);var r=new V;return this.ng2BootstrapDeferred.promise.then((function(t){r._bootstrapDone(e.moduleRef,t)}),m),r},t.prototype.bootstrap=function(t,n,r){var o=this;this.declareNg1Module(n);var i=new V,a=window.angular;a.resumeBootstrap=void 0,this.ngZone.run((function(){!function(t,e,n){p.bootstrap(t,e,n)}(t,[o.ng1Module.name],r)}));var c=new Promise((function(t){if(a.resumeBootstrap){var e=a.resumeBootstrap;a.resumeBootstrap=function(){a.resumeBootstrap=e;var n=a.resumeBootstrap.apply(this,arguments);return t(),n}}else t()}));return Promise.all([this.ng2BootstrapDeferred.promise,c]).then((function(n){var r=s(n,1)[0];l(t).data(v(h),o.moduleRef.injector),o.moduleRef.injector.get(e.NgZone).run((function(){i._bootstrapDone(o.moduleRef,r)}))}),m),i},t.prototype.upgradeNg1Provider=function(t,e){this.upgradedProviders.push({provide:e&&e.asToken||t,useFactory:function(e){return e.get(t)},deps:["$injector"]})},t.prototype.downgradeNg2Provider=function(t){
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
return function e(t,n){void 0===n&&(n="");var r=function(e){var r=""+h+n,o="instantiating injectable '"+(j(t)?w(t):String(t))+"'";C(e,n,r,o);try{return e.get(r).get(t)}catch(t){throw new Error("Error while "+o+": "+(t.message||t))}};return r.$inject=["$injector"],r}(t)},t.prototype.declareNg1Module=function(t){var r=this;void 0===t&&(t=[]);var o,i,s=[],a=this,c=this.ng1Module=p.module(this.idPrefix,t),u=n.platformBrowserDynamic();return this.ngZone=new e.NgZone({enableLongStackTrace:Zone.hasOwnProperty("longStackTraceZoneSpec")}),this.ng2BootstrapDeferred=new O,c.constant("$$angularUpgradeAppType",1).factory(h,(function(){return r.moduleRef.injector.get(e.Injector)})).factory("$$angularLazyModuleRef",[h,function(t){return{injector:t}}]).constant("$$angularNgZone",this.ngZone).factory("$$angularCompiler",(function(){return r.moduleRef.injector.get(e.Compiler)})).config(["$provide","$injector",function(t,n){t.decorator("$rootScope",["$delegate",function(t){if(!(i=t.constructor.prototype).hasOwnProperty("$apply"))throw new Error("Failed to find '$apply' on '$rootScope'!");return o=i.$apply,i.$apply=function(t){return s.push(t)},t}]),n.has("$$testability")&&t.decorator("$$testability",["$delegate",function(t){var n=t.whenStable,r=function(t){n.call(this,(function(){var n=a.moduleRef.injector.get(e.Testability);n.isStable()?t.apply(this,arguments):n.whenStable(r.bind(this,t))}))};return t.whenStable=r,t}])}]),c.run(["$injector","$rootScope",function(t,n){x.resolve(r.ng1ComponentsToBeUpgraded,t).then((function(){var a={providers:[{provide:"$injector",useFactory:function(){return t}},{provide:"$compile",useFactory:function(){return t.get("$compile")}},r.upgradedProviders],imports:[e.resolveForwardRef(r.ng2AppModule)],entryComponents:r.downgradedComponents},c=function(){function t(){}return t.prototype.ngDoBootstrap=function(){},t}();c.decorators=[{type:e.NgModule,args:[Object.assign({jit:!0},a)]}],c.ctorParameters=function(){return[]},u.bootstrapModule(c,[r.compilerOptions,{ngZone:r.ngZone}]).then((function(t){r.moduleRef=t,r.ngZone.run((function(){if(i){for(i.$apply=o;s.length;)n.$apply(s.shift());i=null}}))})).then((function(){return r.ng2BootstrapDeferred.resolve(t)}),m).then((function(){var o=r.ngZone.onMicrotaskEmpty.subscribe({next:function(){return n.$$phase?(e.isDevMode()&&console.warn("A digest was triggered while one was already in progress. This may mean that something is triggering digests outside the Angular zone."),n.$evalAsync((function(){}))):n.$digest()}});n.$on("$destroy",(function(){o.unsubscribe()})),u.onDestroy((function(){return function e(t){var e=t.get("$rootElement");t.get("$rootScope").$destroy(),y(e[0])}(t)}))}))})).catch((function(t){return r.ng2BootstrapDeferred.reject(t)}))}]),c},t}(),V=(function(){function t(t){this.element=t,this.callbacks=[],t.data(v(h),this)}t.prototype.then=function(t){this.injector?t(this.injector):this.callbacks.push(t)},t.prototype.resolve=function(t){this.injector=t,this.element.data(v(h),t),this.element=null,this.callbacks.forEach((function(e){return e(t)})),this.callbacks.length=0}}(),function(){function t(){this._readyFn=null,this.ng1RootScope=null,this.ng1Injector=null,this.ng2ModuleRef=null,this.ng2Injector=null}return t.prototype._bootstrapDone=function(t,e){this.ng2ModuleRef=t,this.ng2Injector=t.injector,this.ng1Injector=e,this.ng1RootScope=e.get("$rootScope"),this._readyFn&&this._readyFn(this)},t.prototype.ready=function(t){this._readyFn=t},t.prototype.dispose=function(){this.ng1Injector.get("$rootScope").$destroy(),this.ng2ModuleRef.destroy()},t}());
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
t.UpgradeAdapter=L,t.UpgradeAdapterRef=V,t.VERSION=r,Object.defineProperty(t,"__esModule",{value:!0})}));