` or any other element with the
* `tooltip` selector,
* like so:
*
* ```
*
* ```
*
* Directives can also control the instantiation, destruction, and positioning of inline template
* elements:
*
* A directive uses a {@link ViewContainerRef} to instantiate, insert, move, and destroy views at
* runtime.
* The {@link ViewContainerRef} is created as a result of `
` element, and represents a
* location in the current view
* where these actions are performed.
*
* Views are always created as children of the current {@link ViewMetadata}, and as siblings of the
* `` element. Thus a
* directive in a child view cannot inject the directive that created it.
*
* Since directives that create views via ViewContainers are common in Angular, and using the full
* `` element syntax is wordy, Angular
* also supports a shorthand notation: `` and `` are
* equivalent.
*
* Thus,
*
* ```
*
* ```
*
* Expands in use to:
*
* ```
*
* ```
*
* Notice that although the shorthand places `*foo="bar"` within the `` element, the binding for
* the directive
* controller is correctly instantiated on the `` element rather than the `` element.
*
* ## Lifecycle hooks
*
* When the directive class implements some {@link ../../guide/lifecycle-hooks.html} the callbacks
* are called by the change detection at defined points in time during the life of the directive.
*
* ### Example
*
* Let's suppose we want to implement the `unless` behavior, to conditionally include a template.
*
* Here is a simple directive that triggers on an `unless` selector:
*
* ```
* @Directive({
* selector: '[unless]',
* inputs: ['unless']
* })
* export class Unless {
* viewContainer: ViewContainerRef;
* templateRef: TemplateRef;
* prevCondition: boolean;
*
* constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef) {
* this.viewContainer = viewContainer;
* this.templateRef = templateRef;
* this.prevCondition = null;
* }
*
* set unless(newCondition) {
* if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) {
* this.prevCondition = true;
* this.viewContainer.clear();
* } else if (!newCondition && (isBlank(this.prevCondition) || this.prevCondition)) {
* this.prevCondition = false;
* this.viewContainer.create(this.templateRef);
* }
* }
* }
* ```
*
* We can then use this `unless` selector in a template:
* ```
*
* ```
*
* Once the directive instantiates the child view, the shorthand notation for the template expands
* and the result is:
*
* ```
*
* ```
*
* Note also that although the `` template still exists inside the ``,
* the instantiated
* view occurs on the second `` which is a sibling to the `` element.
* @ts2dart_const
*/
var DirectiveMetadata = (function (_super) {
__extends(DirectiveMetadata, _super);
function DirectiveMetadata(_a) {
var _b = _a === void 0 ? {} : _a, selector = _b.selector, inputs = _b.inputs, outputs = _b.outputs, properties = _b.properties, events = _b.events, host = _b.host, bindings = _b.bindings, providers = _b.providers, exportAs = _b.exportAs, queries = _b.queries;
_super.call(this);
this.selector = selector;
this._inputs = inputs;
this._properties = properties;
this._outputs = outputs;
this._events = events;
this.host = host;
this.exportAs = exportAs;
this.queries = queries;
this._providers = providers;
this._bindings = bindings;
}
Object.defineProperty(DirectiveMetadata.prototype, "inputs", {
/**
* Enumerates the set of data-bound input properties for a directive
*
* Angular automatically updates input properties during change detection.
*
* The `inputs` property defines a set of `directiveProperty` to `bindingProperty`
* configuration:
*
* - `directiveProperty` specifies the component property where the value is written.
* - `bindingProperty` specifies the DOM property where the value is read from.
*
* When `bindingProperty` is not provided, it is assumed to be equal to `directiveProperty`.
*
* ### Example ([live demo](http://plnkr.co/edit/ivhfXY?p=preview))
*
* The following example creates a component with two data-bound properties.
*
* ```typescript
* @Component({
* selector: 'bank-account',
* inputs: ['bankName', 'id: account-id'],
* template: `
* Bank Name: {{bankName}}
* Account Id: {{id}}
* `
* })
* class BankAccount {
* bankName: string;
* id: string;
*
* // this property is not bound, and won't be automatically updated by Angular
* normalizedBankName: string;
* }
*
* @Component({
* selector: 'app',
* template: `
*
* `,
* directives: [BankAccount]
* })
* class App {}
*
* bootstrap(App);
* ```
*
*/
get: function () {
return lang_1.isPresent(this._properties) && this._properties.length > 0 ? this._properties :
this._inputs;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DirectiveMetadata.prototype, "properties", {
get: function () { return this.inputs; },
enumerable: true,
configurable: true
});
Object.defineProperty(DirectiveMetadata.prototype, "outputs", {
/**
* Enumerates the set of event-bound output properties.
*
* When an output property emits an event, an event handler attached to that event
* the template is invoked.
*
* The `outputs` property defines a set of `directiveProperty` to `bindingProperty`
* configuration:
*
* - `directiveProperty` specifies the component property that emits events.
* - `bindingProperty` specifies the DOM property the event handler is attached to.
*
* ### Example ([live demo](http://plnkr.co/edit/d5CNq7?p=preview))
*
* ```typescript
* @Directive({
* selector: 'interval-dir',
* outputs: ['everySecond', 'five5Secs: everyFiveSeconds']
* })
* class IntervalDir {
* everySecond = new EventEmitter();
* five5Secs = new EventEmitter();
*
* constructor() {
* setInterval(() => this.everySecond.emit("event"), 1000);
* setInterval(() => this.five5Secs.emit("event"), 5000);
* }
* }
*
* @Component({
* selector: 'app',
* template: `
*
*
* `,
* directives: [IntervalDir]
* })
* class App {
* everySecond() { console.log('second'); }
* everyFiveSeconds() { console.log('five seconds'); }
* }
* bootstrap(App);
* ```
*
*/
get: function () {
return lang_1.isPresent(this._events) && this._events.length > 0 ? this._events : this._outputs;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DirectiveMetadata.prototype, "events", {
get: function () { return this.outputs; },
enumerable: true,
configurable: true
});
Object.defineProperty(DirectiveMetadata.prototype, "providers", {
/**
* Defines the set of injectable objects that are visible to a Directive and its light DOM
* children.
*
* ## Simple Example
*
* Here is an example of a class that can be injected:
*
* ```
* class Greeter {
* greet(name:string) {
* return 'Hello ' + name + '!';
* }
* }
*
* @Directive({
* selector: 'greet',
* bindings: [
* Greeter
* ]
* })
* class HelloWorld {
* greeter:Greeter;
*
* constructor(greeter:Greeter) {
* this.greeter = greeter;
* }
* }
* ```
*/
get: function () {
return lang_1.isPresent(this._bindings) && this._bindings.length > 0 ? this._bindings :
this._providers;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DirectiveMetadata.prototype, "bindings", {
/** @deprecated */
get: function () { return this.providers; },
enumerable: true,
configurable: true
});
return DirectiveMetadata;
}(metadata_1.InjectableMetadata));
exports.DirectiveMetadata = DirectiveMetadata;
/**
* Declare reusable UI building blocks for an application.
*
* Each Angular component requires a single `@Component` annotation. The
* `@Component`
* annotation specifies when a component is instantiated, and which properties and hostListeners it
* binds to.
*
* When a component is instantiated, Angular
* - creates a shadow DOM for the component.
* - loads the selected template into the shadow DOM.
* - creates all the injectable objects configured with `providers` and `viewProviders`.
*
* All template expressions and statements are then evaluated against the component instance.
*
* For details on the `@View` annotation, see {@link ViewMetadata}.
*
* ## Lifecycle hooks
*
* When the component class implements some {@link ../../guide/lifecycle-hooks.html} the callbacks
* are called by the change detection at defined points in time during the life of the component.
*
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='component'}
* @ts2dart_const
*/
var ComponentMetadata = (function (_super) {
__extends(ComponentMetadata, _super);
function ComponentMetadata(_a) {
var _b = _a === void 0 ? {} : _a, selector = _b.selector, inputs = _b.inputs, outputs = _b.outputs, properties = _b.properties, events = _b.events, host = _b.host, exportAs = _b.exportAs, moduleId = _b.moduleId, bindings = _b.bindings, providers = _b.providers, viewBindings = _b.viewBindings, viewProviders = _b.viewProviders, _c = _b.changeDetection, changeDetection = _c === void 0 ? constants_1.ChangeDetectionStrategy.Default : _c, queries = _b.queries, templateUrl = _b.templateUrl, template = _b.template, styleUrls = _b.styleUrls, styles = _b.styles, directives = _b.directives, pipes = _b.pipes, encapsulation = _b.encapsulation;
_super.call(this, {
selector: selector,
inputs: inputs,
outputs: outputs,
properties: properties,
events: events,
host: host,
exportAs: exportAs,
bindings: bindings,
providers: providers,
queries: queries
});
this.changeDetection = changeDetection;
this._viewProviders = viewProviders;
this._viewBindings = viewBindings;
this.templateUrl = templateUrl;
this.template = template;
this.styleUrls = styleUrls;
this.styles = styles;
this.directives = directives;
this.pipes = pipes;
this.encapsulation = encapsulation;
this.moduleId = moduleId;
}
Object.defineProperty(ComponentMetadata.prototype, "viewProviders", {
/**
* Defines the set of injectable objects that are visible to its view DOM children.
*
* ## Simple Example
*
* Here is an example of a class that can be injected:
*
* ```
* class Greeter {
* greet(name:string) {
* return 'Hello ' + name + '!';
* }
* }
*
* @Directive({
* selector: 'needs-greeter'
* })
* class NeedsGreeter {
* greeter:Greeter;
*
* constructor(greeter:Greeter) {
* this.greeter = greeter;
* }
* }
*
* @Component({
* selector: 'greet',
* viewProviders: [
* Greeter
* ],
* template: ``,
* directives: [NeedsGreeter]
* })
* class HelloWorld {
* }
*
* ```
*/
get: function () {
return lang_1.isPresent(this._viewBindings) && this._viewBindings.length > 0 ? this._viewBindings :
this._viewProviders;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentMetadata.prototype, "viewBindings", {
get: function () { return this.viewProviders; },
enumerable: true,
configurable: true
});
return ComponentMetadata;
}(DirectiveMetadata));
exports.ComponentMetadata = ComponentMetadata;
/**
* Declare reusable pipe function.
*
* A "pure" pipe is only re-evaluated when either the input or any of the arguments change.
*
* When not specified, pipes default to being pure.
*
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='pipe'}
* @ts2dart_const
*/
var PipeMetadata = (function (_super) {
__extends(PipeMetadata, _super);
function PipeMetadata(_a) {
var name = _a.name, pure = _a.pure;
_super.call(this);
this.name = name;
this._pure = pure;
}
Object.defineProperty(PipeMetadata.prototype, "pure", {
get: function () { return lang_1.isPresent(this._pure) ? this._pure : true; },
enumerable: true,
configurable: true
});
return PipeMetadata;
}(metadata_1.InjectableMetadata));
exports.PipeMetadata = PipeMetadata;
/**
* Declares a data-bound input property.
*
* Angular automatically updates data-bound properties during change detection.
*
* `InputMetadata` takes an optional parameter that specifies the name
* used when instantiating a component in the template. When not provided,
* the name of the decorated property is used.
*
* ### Example
*
* The following example creates a component with two input properties.
*
* ```typescript
* @Component({
* selector: 'bank-account',
* template: `
* Bank Name: {{bankName}}
* Account Id: {{id}}
* `
* })
* class BankAccount {
* @Input() bankName: string;
* @Input('account-id') id: string;
*
* // this property is not bound, and won't be automatically updated by Angular
* normalizedBankName: string;
* }
*
* @Component({
* selector: 'app',
* template: `
*
* `,
* directives: [BankAccount]
* })
* class App {}
*
* bootstrap(App);
* ```
* @ts2dart_const
*/
var InputMetadata = (function () {
function InputMetadata(
/**
* Name used when instantiating a component in the template.
*/
bindingPropertyName) {
this.bindingPropertyName = bindingPropertyName;
}
return InputMetadata;
}());
exports.InputMetadata = InputMetadata;
/**
* Declares an event-bound output property.
*
* When an output property emits an event, an event handler attached to that event
* the template is invoked.
*
* `OutputMetadata` takes an optional parameter that specifies the name
* used when instantiating a component in the template. When not provided,
* the name of the decorated property is used.
*
* ### Example
*
* ```typescript
* @Directive({
* selector: 'interval-dir',
* })
* class IntervalDir {
* @Output() everySecond = new EventEmitter();
* @Output('everyFiveSeconds') five5Secs = new EventEmitter();
*
* constructor() {
* setInterval(() => this.everySecond.emit("event"), 1000);
* setInterval(() => this.five5Secs.emit("event"), 5000);
* }
* }
*
* @Component({
* selector: 'app',
* template: `
*
*
* `,
* directives: [IntervalDir]
* })
* class App {
* everySecond() { console.log('second'); }
* everyFiveSeconds() { console.log('five seconds'); }
* }
* bootstrap(App);
* ```
* @ts2dart_const
*/
var OutputMetadata = (function () {
function OutputMetadata(bindingPropertyName) {
this.bindingPropertyName = bindingPropertyName;
}
return OutputMetadata;
}());
exports.OutputMetadata = OutputMetadata;
/**
* Declares a host property binding.
*
* Angular automatically checks host property bindings during change detection.
* If a binding changes, it will update the host element of the directive.
*
* `HostBindingMetadata` takes an optional parameter that specifies the property
* name of the host element that will be updated. When not provided,
* the class property name is used.
*
* ### Example
*
* The following example creates a directive that sets the `valid` and `invalid` classes
* on the DOM element that has ngModel directive on it.
*
* ```typescript
* @Directive({selector: '[ngModel]'})
* class NgModelStatus {
* constructor(public control:NgModel) {}
* @HostBinding('class.valid') get valid { return this.control.valid; }
* @HostBinding('class.invalid') get invalid { return this.control.invalid; }
* }
*
* @Component({
* selector: 'app',
* template: ``,
* directives: [FORM_DIRECTIVES, NgModelStatus]
* })
* class App {
* prop;
* }
*
* bootstrap(App);
* ```
* @ts2dart_const
*/
var HostBindingMetadata = (function () {
function HostBindingMetadata(hostPropertyName) {
this.hostPropertyName = hostPropertyName;
}
return HostBindingMetadata;
}());
exports.HostBindingMetadata = HostBindingMetadata;
/**
* Declares a host listener.
*
* Angular will invoke the decorated method when the host element emits the specified event.
*
* If the decorated method returns `false`, then `preventDefault` is applied on the DOM
* event.
*
* ### Example
*
* The following example declares a directive that attaches a click listener to the button and
* counts clicks.
*
* ```typescript
* @Directive({selector: 'button[counting]'})
* class CountClicks {
* numberOfClicks = 0;
*
* @HostListener('click', ['$event.target'])
* onClick(btn) {
* console.log("button", btn, "number of clicks:", this.numberOfClicks++);
* }
* }
*
* @Component({
* selector: 'app',
* template: ``,
* directives: [CountClicks]
* })
* class App {}
*
* bootstrap(App);
* ```
* @ts2dart_const
*/
var HostListenerMetadata = (function () {
function HostListenerMetadata(eventName, args) {
this.eventName = eventName;
this.args = args;
}
return HostListenerMetadata;
}());
exports.HostListenerMetadata = HostListenerMetadata;
//# sourceMappingURL=directives.js.map
/***/ },
/* 197 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var lang_1 = __webpack_require__(4);
var exceptions_1 = __webpack_require__(9);
var ReflectionCapabilities = (function () {
function ReflectionCapabilities(reflect) {
this._reflect = lang_1.isPresent(reflect) ? reflect : lang_1.global.Reflect;
}
ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
ReflectionCapabilities.prototype.factory = function (t) {
switch (t.length) {
case 0:
return function () { return new t(); };
case 1:
return function (a1) { return new t(a1); };
case 2:
return function (a1, a2) { return new t(a1, a2); };
case 3:
return function (a1, a2, a3) { return new t(a1, a2, a3); };
case 4:
return function (a1, a2, a3, a4) { return new t(a1, a2, a3, a4); };
case 5:
return function (a1, a2, a3, a4, a5) { return new t(a1, a2, a3, a4, a5); };
case 6:
return function (a1, a2, a3, a4, a5, a6) {
return new t(a1, a2, a3, a4, a5, a6);
};
case 7:
return function (a1, a2, a3, a4, a5, a6, a7) {
return new t(a1, a2, a3, a4, a5, a6, a7);
};
case 8:
return function (a1, a2, a3, a4, a5, a6, a7, a8) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8);
};
case 9:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9);
};
case 10:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
};
case 11:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
};
case 12:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
};
case 13:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
};
case 14:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14);
};
case 15:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
};
case 16:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16);
};
case 17:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
};
case 18:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18);
};
case 19:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19);
};
case 20:
return function (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
};
}
;
throw new Error("Cannot create a factory for '" + lang_1.stringify(t) + "' because its constructor has more than 20 arguments");
};
/** @internal */
ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) {
var result;
if (typeof paramTypes === 'undefined') {
result = new Array(paramAnnotations.length);
}
else {
result = new Array(paramTypes.length);
}
for (var i = 0; i < result.length; i++) {
// TS outputs Object for parameters without types, while Traceur omits
// the annotations. For now we preserve the Traceur behavior to aid
// migration, but this can be revisited.
if (typeof paramTypes === 'undefined') {
result[i] = [];
}
else if (paramTypes[i] != Object) {
result[i] = [paramTypes[i]];
}
else {
result[i] = [];
}
if (lang_1.isPresent(paramAnnotations) && lang_1.isPresent(paramAnnotations[i])) {
result[i] = result[i].concat(paramAnnotations[i]);
}
}
return result;
};
ReflectionCapabilities.prototype.parameters = function (typeOrFunc) {
// Prefer the direct API.
if (lang_1.isPresent(typeOrFunc.parameters)) {
return typeOrFunc.parameters;
}
// API of tsickle for lowering decorators to properties on the class.
if (lang_1.isPresent(typeOrFunc.ctorParameters)) {
var ctorParameters = typeOrFunc.ctorParameters;
var paramTypes_1 = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
var paramAnnotations_1 = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); });
return this._zipTypesAndAnnotations(paramTypes_1, paramAnnotations_1);
}
// API for metadata created by invoking the decorators.
if (lang_1.isPresent(this._reflect) && lang_1.isPresent(this._reflect.getMetadata)) {
var paramAnnotations = this._reflect.getMetadata('parameters', typeOrFunc);
var paramTypes = this._reflect.getMetadata('design:paramtypes', typeOrFunc);
if (lang_1.isPresent(paramTypes) || lang_1.isPresent(paramAnnotations)) {
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
}
}
// The array has to be filled with `undefined` because holes would be skipped by `some`
var parameters = new Array(typeOrFunc.length);
parameters.fill(undefined);
return parameters;
};
ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {
// Prefer the direct API.
if (lang_1.isPresent(typeOrFunc.annotations)) {
var annotations = typeOrFunc.annotations;
if (lang_1.isFunction(annotations) && annotations.annotations) {
annotations = annotations.annotations;
}
return annotations;
}
// API of tsickle for lowering decorators to properties on the class.
if (lang_1.isPresent(typeOrFunc.decorators)) {
return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);
}
// API for metadata created by invoking the decorators.
if (lang_1.isPresent(this._reflect) && lang_1.isPresent(this._reflect.getMetadata)) {
var annotations = this._reflect.getMetadata('annotations', typeOrFunc);
if (lang_1.isPresent(annotations))
return annotations;
}
return [];
};
ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
// Prefer the direct API.
if (lang_1.isPresent(typeOrFunc.propMetadata)) {
var propMetadata = typeOrFunc.propMetadata;
if (lang_1.isFunction(propMetadata) && propMetadata.propMetadata) {
propMetadata = propMetadata.propMetadata;
}
return propMetadata;
}
// API of tsickle for lowering decorators to properties on the class.
if (lang_1.isPresent(typeOrFunc.propDecorators)) {
var propDecorators_1 = typeOrFunc.propDecorators;
var propMetadata_1 = {};
Object.keys(propDecorators_1)
.forEach(function (prop) {
propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
});
return propMetadata_1;
}
// API for metadata created by invoking the decorators.
if (lang_1.isPresent(this._reflect) && lang_1.isPresent(this._reflect.getMetadata)) {
var propMetadata = this._reflect.getMetadata('propMetadata', typeOrFunc);
if (lang_1.isPresent(propMetadata))
return propMetadata;
}
return {};
};
ReflectionCapabilities.prototype.interfaces = function (type) {
throw new exceptions_1.BaseException("JavaScript does not support interfaces");
};
ReflectionCapabilities.prototype.getter = function (name) { return new Function('o', 'return o.' + name + ';'); };
ReflectionCapabilities.prototype.setter = function (name) {
return new Function('o', 'v', 'return o.' + name + ' = v;');
};
ReflectionCapabilities.prototype.method = function (name) {
var functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
return new Function('o', 'args', functionBody);
};
// There is not a concept of import uri in Js, but this is useful in developing Dart applications.
ReflectionCapabilities.prototype.importUri = function (type) { return "./" + lang_1.stringify(type); };
return ReflectionCapabilities;
}());
exports.ReflectionCapabilities = ReflectionCapabilities;
function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
if (!decoratorInvocations) {
return [];
}
return decoratorInvocations.map(function (decoratorInvocation) {
var decoratorType = decoratorInvocation.type;
var annotationCls = decoratorType.annotationCls;
var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
var annotation = Object.create(annotationCls.prototype);
annotationCls.apply(annotation, annotationArgs);
return annotation;
});
}
//# sourceMappingURL=reflection_capabilities.js.map
/***/ },
/* 198 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var lang_1 = __webpack_require__(4);
var exceptions_1 = __webpack_require__(9);
var collection_1 = __webpack_require__(11);
var reflector_reader_1 = __webpack_require__(111);
/**
* Reflective information about a symbol, including annotations, interfaces, and other metadata.
*/
var ReflectionInfo = (function () {
function ReflectionInfo(annotations, parameters, factory, interfaces, propMetadata) {
this.annotations = annotations;
this.parameters = parameters;
this.factory = factory;
this.interfaces = interfaces;
this.propMetadata = propMetadata;
}
return ReflectionInfo;
}());
exports.ReflectionInfo = ReflectionInfo;
/**
* Provides access to reflection data about symbols. Used internally by Angular
* to power dependency injection and compilation.
*/
var Reflector = (function (_super) {
__extends(Reflector, _super);
function Reflector(reflectionCapabilities) {
_super.call(this);
/** @internal */
this._injectableInfo = new collection_1.Map();
/** @internal */
this._getters = new collection_1.Map();
/** @internal */
this._setters = new collection_1.Map();
/** @internal */
this._methods = new collection_1.Map();
this._usedKeys = null;
this.reflectionCapabilities = reflectionCapabilities;
}
Reflector.prototype.isReflectionEnabled = function () { return this.reflectionCapabilities.isReflectionEnabled(); };
/**
* Causes `this` reflector to track keys used to access
* {@link ReflectionInfo} objects.
*/
Reflector.prototype.trackUsage = function () { this._usedKeys = new collection_1.Set(); };
/**
* Lists types for which reflection information was not requested since
* {@link #trackUsage} was called. This list could later be audited as
* potential dead code.
*/
Reflector.prototype.listUnusedKeys = function () {
var _this = this;
if (this._usedKeys == null) {
throw new exceptions_1.BaseException('Usage tracking is disabled');
}
var allTypes = collection_1.MapWrapper.keys(this._injectableInfo);
return allTypes.filter(function (key) { return !collection_1.SetWrapper.has(_this._usedKeys, key); });
};
Reflector.prototype.registerFunction = function (func, funcInfo) {
this._injectableInfo.set(func, funcInfo);
};
Reflector.prototype.registerType = function (type, typeInfo) {
this._injectableInfo.set(type, typeInfo);
};
Reflector.prototype.registerGetters = function (getters) { _mergeMaps(this._getters, getters); };
Reflector.prototype.registerSetters = function (setters) { _mergeMaps(this._setters, setters); };
Reflector.prototype.registerMethods = function (methods) { _mergeMaps(this._methods, methods); };
Reflector.prototype.factory = function (type) {
if (this._containsReflectionInfo(type)) {
var res = this._getReflectionInfo(type).factory;
return lang_1.isPresent(res) ? res : null;
}
else {
return this.reflectionCapabilities.factory(type);
}
};
Reflector.prototype.parameters = function (typeOrFunc) {
if (this._injectableInfo.has(typeOrFunc)) {
var res = this._getReflectionInfo(typeOrFunc).parameters;
return lang_1.isPresent(res) ? res : [];
}
else {
return this.reflectionCapabilities.parameters(typeOrFunc);
}
};
Reflector.prototype.annotations = function (typeOrFunc) {
if (this._injectableInfo.has(typeOrFunc)) {
var res = this._getReflectionInfo(typeOrFunc).annotations;
return lang_1.isPresent(res) ? res : [];
}
else {
return this.reflectionCapabilities.annotations(typeOrFunc);
}
};
Reflector.prototype.propMetadata = function (typeOrFunc) {
if (this._injectableInfo.has(typeOrFunc)) {
var res = this._getReflectionInfo(typeOrFunc).propMetadata;
return lang_1.isPresent(res) ? res : {};
}
else {
return this.reflectionCapabilities.propMetadata(typeOrFunc);
}
};
Reflector.prototype.interfaces = function (type) {
if (this._injectableInfo.has(type)) {
var res = this._getReflectionInfo(type).interfaces;
return lang_1.isPresent(res) ? res : [];
}
else {
return this.reflectionCapabilities.interfaces(type);
}
};
Reflector.prototype.getter = function (name) {
if (this._getters.has(name)) {
return this._getters.get(name);
}
else {
return this.reflectionCapabilities.getter(name);
}
};
Reflector.prototype.setter = function (name) {
if (this._setters.has(name)) {
return this._setters.get(name);
}
else {
return this.reflectionCapabilities.setter(name);
}
};
Reflector.prototype.method = function (name) {
if (this._methods.has(name)) {
return this._methods.get(name);
}
else {
return this.reflectionCapabilities.method(name);
}
};
/** @internal */
Reflector.prototype._getReflectionInfo = function (typeOrFunc) {
if (lang_1.isPresent(this._usedKeys)) {
this._usedKeys.add(typeOrFunc);
}
return this._injectableInfo.get(typeOrFunc);
};
/** @internal */
Reflector.prototype._containsReflectionInfo = function (typeOrFunc) { return this._injectableInfo.has(typeOrFunc); };
Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
return Reflector;
}(reflector_reader_1.ReflectorReader));
exports.Reflector = Reflector;
function _mergeMaps(target, config) {
collection_1.StringMapWrapper.forEach(config, function (v, k) { return target.set(k, v); });
}
//# sourceMappingURL=reflector.js.map
/***/ },
/* 199 */
/***/ function(module, exports) {
"use strict";
/**
* A SecurityContext marks a location that has dangerous security implications, e.g. a DOM property
* like `innerHTML` that could cause Cross Site Scripting (XSS) security bugs when improperly
* handled.
*
* See DomSanitizationService for more details on security in Angular applications.
*/
(function (SecurityContext) {
SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
SecurityContext[SecurityContext["HTML"] = 1] = "HTML";
SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE";
SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
SecurityContext[SecurityContext["URL"] = 4] = "URL";
SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
})(exports.SecurityContext || (exports.SecurityContext = {}));
var SecurityContext = exports.SecurityContext;
/**
* SanitizationService is used by the views to sanitize potentially dangerous values. This is a
* private API, use code should only refer to DomSanitizationService.
*/
var SanitizationService = (function () {
function SanitizationService() {
}
return SanitizationService;
}());
exports.SanitizationService = SanitizationService;
//# sourceMappingURL=security.js.map
/***/ },
/* 200 */
/***/ function(module, exports) {
"use strict";
/**
* Stores error information; delivered via [NgZone.onError] stream.
*/
var NgZoneError = (function () {
function NgZoneError(error, stackTrace) {
this.error = error;
this.stackTrace = stackTrace;
}
return NgZoneError;
}());
exports.NgZoneError = NgZoneError;
var NgZoneImpl = (function () {
function NgZoneImpl(_a) {
var _this = this;
var trace = _a.trace, onEnter = _a.onEnter, onLeave = _a.onLeave, setMicrotask = _a.setMicrotask, setMacrotask = _a.setMacrotask, onError = _a.onError;
this.onEnter = onEnter;
this.onLeave = onLeave;
this.setMicrotask = setMicrotask;
this.setMacrotask = setMacrotask;
this.onError = onError;
if (Zone) {
this.outer = this.inner = Zone.current;
if (Zone['wtfZoneSpec']) {
this.inner = this.inner.fork(Zone['wtfZoneSpec']);
}
if (trace && Zone['longStackTraceZoneSpec']) {
this.inner = this.inner.fork(Zone['longStackTraceZoneSpec']);
}
this.inner = this.inner.fork({
name: 'angular',
properties: { 'isAngularZone': true },
onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
try {
_this.onEnter();
return delegate.invokeTask(target, task, applyThis, applyArgs);
}
finally {
_this.onLeave();
}
},
onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
try {
_this.onEnter();
return delegate.invoke(target, callback, applyThis, applyArgs, source);
}
finally {
_this.onLeave();
}
},
onHasTask: function (delegate, current, target, hasTaskState) {
delegate.hasTask(target, hasTaskState);
if (current == target) {
// We are only interested in hasTask events which originate from our zone
// (A child hasTask event is not interesting to us)
if (hasTaskState.change == 'microTask') {
_this.setMicrotask(hasTaskState.microTask);
}
else if (hasTaskState.change == 'macroTask') {
_this.setMacrotask(hasTaskState.macroTask);
}
}
},
onHandleError: function (delegate, current, target, error) {
delegate.handleError(target, error);
_this.onError(new NgZoneError(error, error.stack));
return false;
}
});
}
else {
throw new Error('Angular requires Zone.js polyfill.');
}
}
NgZoneImpl.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; };
NgZoneImpl.prototype.runInner = function (fn) { return this.inner.run(fn); };
;
NgZoneImpl.prototype.runInnerGuarded = function (fn) { return this.inner.runGuarded(fn); };
;
NgZoneImpl.prototype.runOuter = function (fn) { return this.outer.run(fn); };
;
return NgZoneImpl;
}());
exports.NgZoneImpl = NgZoneImpl;
//# sourceMappingURL=ng_zone_impl.js.map
/***/ },
/* 201 */,
/* 202 */,
/* 203 */,
/* 204 */,
/* 205 */,
/* 206 */,
/* 207 */,
/* 208 */,
/* 209 */,
/* 210 */,
/* 211 */,
/* 212 */,
/* 213 */,
/* 214 */,
/* 215 */,
/* 216 */,
/* 217 */,
/* 218 */,
/* 219 */,
/* 220 */,
/* 221 */,
/* 222 */,
/* 223 */,
/* 224 */,
/* 225 */,
/* 226 */,
/* 227 */,
/* 228 */,
/* 229 */,
/* 230 */,
/* 231 */,
/* 232 */,
/* 233 */,
/* 234 */,
/* 235 */,
/* 236 */,
/* 237 */,
/* 238 */,
/* 239 */,
/* 240 */,
/* 241 */,
/* 242 */,
/* 243 */,
/* 244 */,
/* 245 */,
/* 246 */,
/* 247 */,
/* 248 */,
/* 249 */,
/* 250 */,
/* 251 */,
/* 252 */,
/* 253 */,
/* 254 */,
/* 255 */,
/* 256 */,
/* 257 */,
/* 258 */,
/* 259 */,
/* 260 */,
/* 261 */,
/* 262 */,
/* 263 */,
/* 264 */,
/* 265 */,
/* 266 */,
/* 267 */,
/* 268 */,
/* 269 */,
/* 270 */,
/* 271 */,
/* 272 */,
/* 273 */,
/* 274 */,
/* 275 */,
/* 276 */,
/* 277 */,
/* 278 */,
/* 279 */,
/* 280 */,
/* 281 */,
/* 282 */,
/* 283 */,
/* 284 */,
/* 285 */,
/* 286 */,
/* 287 */,
/* 288 */,
/* 289 */,
/* 290 */,
/* 291 */,
/* 292 */,
/* 293 */,
/* 294 */,
/* 295 */,
/* 296 */,
/* 297 */,
/* 298 */,
/* 299 */,
/* 300 */,
/* 301 */,
/* 302 */,
/* 303 */,
/* 304 */,
/* 305 */,
/* 306 */,
/* 307 */,
/* 308 */,
/* 309 */,
/* 310 */,
/* 311 */,
/* 312 */,
/* 313 */,
/* 314 */,
/* 315 */,
/* 316 */,
/* 317 */,
/* 318 */,
/* 319 */,
/* 320 */,
/* 321 */,
/* 322 */,
/* 323 */,
/* 324 */,
/* 325 */,
/* 326 */,
/* 327 */,
/* 328 */,
/* 329 */,
/* 330 */,
/* 331 */,
/* 332 */,
/* 333 */,
/* 334 */,
/* 335 */,
/* 336 */,
/* 337 */,
/* 338 */,
/* 339 */,
/* 340 */,
/* 341 */,
/* 342 */,
/* 343 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var isFunction_1 = __webpack_require__(345);
var Subscription_1 = __webpack_require__(134);
var rxSubscriber_1 = __webpack_require__(137);
var Observer_1 = __webpack_require__(444);
/**
* Implements the {@link Observer} interface and extends the
* {@link Subscription} class. While the {@link Observer} is the public API for
* consuming the values of an {@link Observable}, all Observers get converted to
* a Subscriber, in order to provide Subscription-like capabilities such as
* `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
* implementing operators, but it is rarely used as a public API.
*
* @class Subscriber
*/
var Subscriber = (function (_super) {
__extends(Subscriber, _super);
/**
* @param {Observer|function(value: T): void} [destinationOrNext] A partially
* defined Observer or a `next` callback function.
* @param {function(e: ?any): void} [error] The `error` callback of an
* Observer.
* @param {function(): void} [complete] The `complete` callback of an
* Observer.
*/
function Subscriber(destinationOrNext, error, complete) {
_super.call(this);
this.syncErrorValue = null;
this.syncErrorThrown = false;
this.syncErrorThrowable = false;
this.isStopped = false;
switch (arguments.length) {
case 0:
this.destination = Observer_1.empty;
break;
case 1:
if (!destinationOrNext) {
this.destination = Observer_1.empty;
break;
}
if (typeof destinationOrNext === 'object') {
if (destinationOrNext instanceof Subscriber) {
this.destination = destinationOrNext;
this.destination.add(this);
}
else {
this.syncErrorThrowable = true;
this.destination = new SafeSubscriber(this, destinationOrNext);
}
break;
}
default:
this.syncErrorThrowable = true;
this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
break;
}
}
/**
* A static factory for a Subscriber, given a (potentially partial) definition
* of an Observer.
* @param {function(x: ?T): void} [next] The `next` callback of an Observer.
* @param {function(e: ?any): void} [error] The `error` callback of an
* Observer.
* @param {function(): void} [complete] The `complete` callback of an
* Observer.
* @return {Subscriber} A Subscriber wrapping the (partially defined)
* Observer represented by the given arguments.
*/
Subscriber.create = function (next, error, complete) {
var subscriber = new Subscriber(next, error, complete);
subscriber.syncErrorThrowable = false;
return subscriber;
};
/**
* The {@link Observer} callback to receive notifications of type `next` from
* the Observable, with a value. The Observable may call this method 0 or more
* times.
* @param {T} [value] The `next` value.
* @return {void}
*/
Subscriber.prototype.next = function (value) {
if (!this.isStopped) {
this._next(value);
}
};
/**
* The {@link Observer} callback to receive notifications of type `error` from
* the Observable, with an attached {@link Error}. Notifies the Observer that
* the Observable has experienced an error condition.
* @param {any} [err] The `error` exception.
* @return {void}
*/
Subscriber.prototype.error = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this._error(err);
}
};
/**
* The {@link Observer} callback to receive a valueless notification of type
* `complete` from the Observable. Notifies the Observer that the Observable
* has finished sending push-based notifications.
* @return {void}
*/
Subscriber.prototype.complete = function () {
if (!this.isStopped) {
this.isStopped = true;
this._complete();
}
};
Subscriber.prototype.unsubscribe = function () {
if (this.isUnsubscribed) {
return;
}
this.isStopped = true;
_super.prototype.unsubscribe.call(this);
};
Subscriber.prototype._next = function (value) {
this.destination.next(value);
};
Subscriber.prototype._error = function (err) {
this.destination.error(err);
this.unsubscribe();
};
Subscriber.prototype._complete = function () {
this.destination.complete();
this.unsubscribe();
};
Subscriber.prototype[rxSubscriber_1.$$rxSubscriber] = function () {
return this;
};
return Subscriber;
}(Subscription_1.Subscription));
exports.Subscriber = Subscriber;
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var SafeSubscriber = (function (_super) {
__extends(SafeSubscriber, _super);
function SafeSubscriber(_parent, observerOrNext, error, complete) {
_super.call(this);
this._parent = _parent;
var next;
var context = this;
if (isFunction_1.isFunction(observerOrNext)) {
next = observerOrNext;
}
else if (observerOrNext) {
context = observerOrNext;
next = observerOrNext.next;
error = observerOrNext.error;
complete = observerOrNext.complete;
if (isFunction_1.isFunction(context.unsubscribe)) {
this.add(context.unsubscribe.bind(context));
}
context.unsubscribe = this.unsubscribe.bind(this);
}
this._context = context;
this._next = next;
this._error = error;
this._complete = complete;
}
SafeSubscriber.prototype.next = function (value) {
if (!this.isStopped && this._next) {
var _parent = this._parent;
if (!_parent.syncErrorThrowable) {
this.__tryOrUnsub(this._next, value);
}
else if (this.__tryOrSetError(_parent, this._next, value)) {
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.error = function (err) {
if (!this.isStopped) {
var _parent = this._parent;
if (this._error) {
if (!_parent.syncErrorThrowable) {
this.__tryOrUnsub(this._error, err);
this.unsubscribe();
}
else {
this.__tryOrSetError(_parent, this._error, err);
this.unsubscribe();
}
}
else if (!_parent.syncErrorThrowable) {
this.unsubscribe();
throw err;
}
else {
_parent.syncErrorValue = err;
_parent.syncErrorThrown = true;
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.complete = function () {
if (!this.isStopped) {
var _parent = this._parent;
if (this._complete) {
if (!_parent.syncErrorThrowable) {
this.__tryOrUnsub(this._complete);
this.unsubscribe();
}
else {
this.__tryOrSetError(_parent, this._complete);
this.unsubscribe();
}
}
else {
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
try {
fn.call(this._context, value);
}
catch (err) {
this.unsubscribe();
throw err;
}
};
SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
try {
fn.call(this._context, value);
}
catch (err) {
parent.syncErrorValue = err;
parent.syncErrorThrown = true;
return true;
}
return false;
};
SafeSubscriber.prototype._unsubscribe = function () {
var _parent = this._parent;
this._context = null;
this._parent = null;
_parent.unsubscribe();
};
return SafeSubscriber;
}(Subscriber));
//# sourceMappingURL=Subscriber.js.map
/***/ },
/* 344 */
/***/ function(module, exports) {
"use strict";
// typeof any so that it we don't have to cast when comparing a result to the error object
exports.errorObject = { e: {} };
//# sourceMappingURL=errorObject.js.map
/***/ },
/* 345 */
/***/ function(module, exports) {
"use strict";
function isFunction(x) {
return typeof x === 'function';
}
exports.isFunction = isFunction;
//# sourceMappingURL=isFunction.js.map
/***/ },
/* 346 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var forms_1 = __webpack_require__(152);
var directives_1 = __webpack_require__(142);
/**
* A collection of Angular core directives that are likely to be used in each and every Angular
* application. This includes core directives (e.g., NgIf and NgFor), and forms directives (e.g.,
* NgModel).
*
* This collection can be used to quickly enumerate all the built-in directives in the `directives`
* property of the `@Component` decorator.
*
* ### Example
*
* Instead of writing:
*
* ```typescript
* import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, NgModel, NgForm} from
* '@angular/common';
* import {OtherDirective} from './myDirectives';
*
* @Component({
* selector: 'my-component',
* templateUrl: 'myComponent.html',
* directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, NgModel, NgForm,
* OtherDirective]
* })
* export class MyComponent {
* ...
* }
* ```
* one could import all the common directives at once:
*
* ```typescript
* import {COMMON_DIRECTIVES} from '@angular/common';
* import {OtherDirective} from './myDirectives';
*
* @Component({
* selector: 'my-component',
* templateUrl: 'myComponent.html',
* directives: [COMMON_DIRECTIVES, OtherDirective]
* })
* export class MyComponent {
* ...
* }
* ```
*/
exports.COMMON_DIRECTIVES = [directives_1.CORE_DIRECTIVES, forms_1.FORM_DIRECTIVES];
//# sourceMappingURL=common_directives.js.map
/***/ },
/* 347 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var ng_class_1 = __webpack_require__(143);
var ng_for_1 = __webpack_require__(144);
var ng_if_1 = __webpack_require__(145);
var ng_template_outlet_1 = __webpack_require__(148);
var ng_style_1 = __webpack_require__(147);
var ng_switch_1 = __webpack_require__(73);
var ng_plural_1 = __webpack_require__(146);
/**
* A collection of Angular core directives that are likely to be used in each and every Angular
* application.
*
* This collection can be used to quickly enumerate all the built-in directives in the `directives`
* property of the `@Component` annotation.
*
* ### Example ([live demo](http://plnkr.co/edit/yakGwpCdUkg0qfzX5m8g?p=preview))
*
* Instead of writing:
*
* ```typescript
* import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from '@angular/common';
* import {OtherDirective} from './myDirectives';
*
* @Component({
* selector: 'my-component',
* templateUrl: 'myComponent.html',
* directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, OtherDirective]
* })
* export class MyComponent {
* ...
* }
* ```
* one could import all the core directives at once:
*
* ```typescript
* import {CORE_DIRECTIVES} from '@angular/common';
* import {OtherDirective} from './myDirectives';
*
* @Component({
* selector: 'my-component',
* templateUrl: 'myComponent.html',
* directives: [CORE_DIRECTIVES, OtherDirective]
* })
* export class MyComponent {
* ...
* }
* ```
*/
exports.CORE_DIRECTIVES = [
ng_class_1.NgClass,
ng_for_1.NgFor,
ng_if_1.NgIf,
ng_template_outlet_1.NgTemplateOutlet,
ng_style_1.NgStyle,
ng_switch_1.NgSwitch,
ng_switch_1.NgSwitchWhen,
ng_switch_1.NgSwitchDefault,
ng_plural_1.NgPlural,
ng_plural_1.NgPluralCase
];
//# sourceMappingURL=core_directives.js.map
/***/ },
/* 348 */
/***/ function(module, exports) {
"use strict";
//# sourceMappingURL=observable_list_diff.js.map
/***/ },
/* 349 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var ng_control_name_1 = __webpack_require__(77);
var ng_form_control_1 = __webpack_require__(80);
var ng_model_1 = __webpack_require__(82);
var ng_control_group_1 = __webpack_require__(76);
var ng_form_model_1 = __webpack_require__(81);
var ng_form_1 = __webpack_require__(79);
var default_value_accessor_1 = __webpack_require__(48);
var checkbox_value_accessor_1 = __webpack_require__(47);
var number_value_accessor_1 = __webpack_require__(83);
var radio_control_value_accessor_1 = __webpack_require__(49);
var ng_control_status_1 = __webpack_require__(78);
var select_control_value_accessor_1 = __webpack_require__(50);
var validators_1 = __webpack_require__(84);
var ng_control_name_2 = __webpack_require__(77);
exports.NgControlName = ng_control_name_2.NgControlName;
var ng_form_control_2 = __webpack_require__(80);
exports.NgFormControl = ng_form_control_2.NgFormControl;
var ng_model_2 = __webpack_require__(82);
exports.NgModel = ng_model_2.NgModel;
var ng_control_group_2 = __webpack_require__(76);
exports.NgControlGroup = ng_control_group_2.NgControlGroup;
var ng_form_model_2 = __webpack_require__(81);
exports.NgFormModel = ng_form_model_2.NgFormModel;
var ng_form_2 = __webpack_require__(79);
exports.NgForm = ng_form_2.NgForm;
var default_value_accessor_2 = __webpack_require__(48);
exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor;
var checkbox_value_accessor_2 = __webpack_require__(47);
exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor;
var radio_control_value_accessor_2 = __webpack_require__(49);
exports.RadioControlValueAccessor = radio_control_value_accessor_2.RadioControlValueAccessor;
exports.RadioButtonState = radio_control_value_accessor_2.RadioButtonState;
var number_value_accessor_2 = __webpack_require__(83);
exports.NumberValueAccessor = number_value_accessor_2.NumberValueAccessor;
var ng_control_status_2 = __webpack_require__(78);
exports.NgControlStatus = ng_control_status_2.NgControlStatus;
var select_control_value_accessor_2 = __webpack_require__(50);
exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor;
exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption;
var validators_2 = __webpack_require__(84);
exports.RequiredValidator = validators_2.RequiredValidator;
exports.MinLengthValidator = validators_2.MinLengthValidator;
exports.MaxLengthValidator = validators_2.MaxLengthValidator;
exports.PatternValidator = validators_2.PatternValidator;
var ng_control_1 = __webpack_require__(26);
exports.NgControl = ng_control_1.NgControl;
/**
*
* A list of all the form directives used as part of a `@Component` annotation.
*
* This is a shorthand for importing them each individually.
*
* ### Example
*
* ```typescript
* @Component({
* selector: 'my-app',
* directives: [FORM_DIRECTIVES]
* })
* class MyApp {}
* ```
*/
exports.FORM_DIRECTIVES = [
ng_control_name_1.NgControlName,
ng_control_group_1.NgControlGroup,
ng_form_control_1.NgFormControl,
ng_model_1.NgModel,
ng_form_model_1.NgFormModel,
ng_form_1.NgForm,
select_control_value_accessor_1.NgSelectOption,
default_value_accessor_1.DefaultValueAccessor,
number_value_accessor_1.NumberValueAccessor,
checkbox_value_accessor_1.CheckboxControlValueAccessor,
select_control_value_accessor_1.SelectControlValueAccessor,
radio_control_value_accessor_1.RadioControlValueAccessor,
ng_control_status_1.NgControlStatus,
validators_1.RequiredValidator,
validators_1.MinLengthValidator,
validators_1.MaxLengthValidator,
validators_1.PatternValidator
];
//# sourceMappingURL=directives.js.map
/***/ },
/* 350 */
/***/ function(module, exports) {
"use strict";
function normalizeValidator(validator) {
if (validator.validate !== undefined) {
return function (c) { return validator.validate(c); };
}
else {
return validator;
}
}
exports.normalizeValidator = normalizeValidator;
function normalizeAsyncValidator(validator) {
if (validator.validate !== undefined) {
return function (c) { return Promise.resolve(validator.validate(c)); };
}
else {
return validator;
}
}
exports.normalizeAsyncValidator = normalizeAsyncValidator;
//# sourceMappingURL=normalize_validator.js.map
/***/ },
/* 351 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(__webpack_require__(86));
__export(__webpack_require__(52));
__export(__webpack_require__(352));
__export(__webpack_require__(353));
__export(__webpack_require__(85));
//# sourceMappingURL=location.js.map
/***/ },
/* 352 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var core_1 = __webpack_require__(1);
var lang_1 = __webpack_require__(5);
var location_strategy_1 = __webpack_require__(52);
var location_1 = __webpack_require__(85);
var platform_location_1 = __webpack_require__(86);
var HashLocationStrategy = (function (_super) {
__extends(HashLocationStrategy, _super);
function HashLocationStrategy(_platformLocation, _baseHref) {
_super.call(this);
this._platformLocation = _platformLocation;
this._baseHref = '';
if (lang_1.isPresent(_baseHref)) {
this._baseHref = _baseHref;
}
}
HashLocationStrategy.prototype.onPopState = function (fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
};
HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
HashLocationStrategy.prototype.path = function () {
// the hash value is always prefixed with a `#`
// and if it is empty then it will stay empty
var path = this._platformLocation.hash;
if (!lang_1.isPresent(path))
path = '#';
// Dart will complain if a call to substring is
// executed with a position value that extends the
// length of string.
return (path.length > 0 ? path.substring(1) : path);
};
HashLocationStrategy.prototype.prepareExternalUrl = function (internal) {
var url = location_1.Location.joinWithSlash(this._baseHref, internal);
return url.length > 0 ? ('#' + url) : url;
};
HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) {
var url = this.prepareExternalUrl(path + location_1.Location.normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.pushState(state, title, url);
};
HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) {
var url = this.prepareExternalUrl(path + location_1.Location.normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.replaceState(state, title, url);
};
HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
HashLocationStrategy.decorators = [
{ type: core_1.Injectable },
];
HashLocationStrategy.ctorParameters = [
{ type: platform_location_1.PlatformLocation, },
{ type: undefined, decorators: [{ type: core_1.Optional }, { type: core_1.Inject, args: [location_strategy_1.APP_BASE_HREF,] },] },
];
return HashLocationStrategy;
}(location_strategy_1.LocationStrategy));
exports.HashLocationStrategy = HashLocationStrategy;
//# sourceMappingURL=hash_location_strategy.js.map
/***/ },
/* 353 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var core_1 = __webpack_require__(1);
var lang_1 = __webpack_require__(5);
var exceptions_1 = __webpack_require__(23);
var platform_location_1 = __webpack_require__(86);
var location_strategy_1 = __webpack_require__(52);
var location_1 = __webpack_require__(85);
var PathLocationStrategy = (function (_super) {
__extends(PathLocationStrategy, _super);
function PathLocationStrategy(_platformLocation, href) {
_super.call(this);
this._platformLocation = _platformLocation;
if (lang_1.isBlank(href)) {
href = this._platformLocation.getBaseHrefFromDOM();
}
if (lang_1.isBlank(href)) {
throw new exceptions_1.BaseException("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");
}
this._baseHref = href;
}
PathLocationStrategy.prototype.onPopState = function (fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
};
PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
PathLocationStrategy.prototype.prepareExternalUrl = function (internal) {
return location_1.Location.joinWithSlash(this._baseHref, internal);
};
PathLocationStrategy.prototype.path = function () {
return this._platformLocation.pathname +
location_1.Location.normalizeQueryParams(this._platformLocation.search);
};
PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) {
var externalUrl = this.prepareExternalUrl(url + location_1.Location.normalizeQueryParams(queryParams));
this._platformLocation.pushState(state, title, externalUrl);
};
PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) {
var externalUrl = this.prepareExternalUrl(url + location_1.Location.normalizeQueryParams(queryParams));
this._platformLocation.replaceState(state, title, externalUrl);
};
PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
PathLocationStrategy.decorators = [
{ type: core_1.Injectable },
];
PathLocationStrategy.ctorParameters = [
{ type: platform_location_1.PlatformLocation, },
{ type: undefined, decorators: [{ type: core_1.Optional }, { type: core_1.Inject, args: [location_strategy_1.APP_BASE_HREF,] },] },
];
return PathLocationStrategy;
}(location_strategy_1.LocationStrategy));
exports.PathLocationStrategy = PathLocationStrategy;
//# sourceMappingURL=path_location_strategy.js.map
/***/ },
/* 354 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
/**
* @module
* @description
* This module provides a set of common Pipes.
*/
var async_pipe_1 = __webpack_require__(154);
exports.AsyncPipe = async_pipe_1.AsyncPipe;
var date_pipe_1 = __webpack_require__(155);
exports.DatePipe = date_pipe_1.DatePipe;
var json_pipe_1 = __webpack_require__(158);
exports.JsonPipe = json_pipe_1.JsonPipe;
var slice_pipe_1 = __webpack_require__(162);
exports.SlicePipe = slice_pipe_1.SlicePipe;
var lowercase_pipe_1 = __webpack_require__(159);
exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe;
var number_pipe_1 = __webpack_require__(160);
exports.NumberPipe = number_pipe_1.NumberPipe;
exports.DecimalPipe = number_pipe_1.DecimalPipe;
exports.PercentPipe = number_pipe_1.PercentPipe;
exports.CurrencyPipe = number_pipe_1.CurrencyPipe;
var uppercase_pipe_1 = __webpack_require__(163);
exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe;
var replace_pipe_1 = __webpack_require__(161);
exports.ReplacePipe = replace_pipe_1.ReplacePipe;
var i18n_plural_pipe_1 = __webpack_require__(156);
exports.I18nPluralPipe = i18n_plural_pipe_1.I18nPluralPipe;
var i18n_select_pipe_1 = __webpack_require__(157);
exports.I18nSelectPipe = i18n_select_pipe_1.I18nSelectPipe;
var common_pipes_1 = __webpack_require__(355);
exports.COMMON_PIPES = common_pipes_1.COMMON_PIPES;
//# sourceMappingURL=pipes.js.map
/***/ },
/* 355 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
/**
* @module
* @description
* This module provides a set of common Pipes.
*/
var async_pipe_1 = __webpack_require__(154);
var uppercase_pipe_1 = __webpack_require__(163);
var lowercase_pipe_1 = __webpack_require__(159);
var json_pipe_1 = __webpack_require__(158);
var slice_pipe_1 = __webpack_require__(162);
var date_pipe_1 = __webpack_require__(155);
var number_pipe_1 = __webpack_require__(160);
var replace_pipe_1 = __webpack_require__(161);
var i18n_plural_pipe_1 = __webpack_require__(156);
var i18n_select_pipe_1 = __webpack_require__(157);
/**
* A collection of Angular core pipes that are likely to be used in each and every
* application.
*
* This collection can be used to quickly enumerate all the built-in pipes in the `pipes`
* property of the `@Component` decorator.
*/
exports.COMMON_PIPES = [
async_pipe_1.AsyncPipe,
uppercase_pipe_1.UpperCasePipe,
lowercase_pipe_1.LowerCasePipe,
json_pipe_1.JsonPipe,
slice_pipe_1.SlicePipe,
number_pipe_1.DecimalPipe,
number_pipe_1.PercentPipe,
number_pipe_1.CurrencyPipe,
date_pipe_1.DatePipe,
replace_pipe_1.ReplacePipe,
i18n_plural_pipe_1.I18nPluralPipe,
i18n_select_pipe_1.I18nSelectPipe
];
//# sourceMappingURL=common_pipes.js.map
/***/ },
/* 356 */,
/* 357 */,
/* 358 */,
/* 359 */,
/* 360 */,
/* 361 */,
/* 362 */,
/* 363 */,
/* 364 */,
/* 365 */,
/* 366 */,
/* 367 */,
/* 368 */,
/* 369 */,
/* 370 */,
/* 371 */,
/* 372 */,
/* 373 */,
/* 374 */,
/* 375 */,
/* 376 */,
/* 377 */,
/* 378 */,
/* 379 */,
/* 380 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var constants = __webpack_require__(60);
var security = __webpack_require__(199);
var reflective_provider = __webpack_require__(107);
var lifecycle_hooks = __webpack_require__(392);
var reflector_reader = __webpack_require__(111);
var component_resolver = __webpack_require__(40);
var element = __webpack_require__(108);
var view = __webpack_require__(390);
var view_type = __webpack_require__(62);
var view_utils = __webpack_require__(63);
var metadata_view = __webpack_require__(110);
var debug_context = __webpack_require__(189);
var change_detection_util = __webpack_require__(100);
var api = __webpack_require__(112);
var template_ref = __webpack_require__(192);
var wtf_init = __webpack_require__(396);
var reflection_capabilities = __webpack_require__(197);
var decorators = __webpack_require__(66);
var debug = __webpack_require__(384);
var provider_util = __webpack_require__(184);
var console = __webpack_require__(102);
exports.__core_private__ = {
isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy,
ChangeDetectorState: constants.ChangeDetectorState,
CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES,
constructDependencies: reflective_provider.constructDependencies,
LifecycleHooks: lifecycle_hooks.LifecycleHooks,
LIFECYCLE_HOOKS_VALUES: lifecycle_hooks.LIFECYCLE_HOOKS_VALUES,
ReflectorReader: reflector_reader.ReflectorReader,
ReflectorComponentResolver: component_resolver.ReflectorComponentResolver,
AppElement: element.AppElement,
AppView: view.AppView,
DebugAppView: view.DebugAppView,
ViewType: view_type.ViewType,
MAX_INTERPOLATION_VALUES: view_utils.MAX_INTERPOLATION_VALUES,
checkBinding: view_utils.checkBinding,
flattenNestedViewRenderNodes: view_utils.flattenNestedViewRenderNodes,
interpolate: view_utils.interpolate,
ViewUtils: view_utils.ViewUtils,
VIEW_ENCAPSULATION_VALUES: metadata_view.VIEW_ENCAPSULATION_VALUES,
DebugContext: debug_context.DebugContext,
StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo,
devModeEqual: change_detection_util.devModeEqual,
uninitialized: change_detection_util.uninitialized,
ValueUnwrapper: change_detection_util.ValueUnwrapper,
RenderDebugInfo: api.RenderDebugInfo,
SecurityContext: security.SecurityContext,
SanitizationService: security.SanitizationService,
TemplateRef_: template_ref.TemplateRef_,
wtfInit: wtf_init.wtfInit,
ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities,
makeDecorator: decorators.makeDecorator,
DebugDomRootRenderer: debug.DebugDomRootRenderer,
createProvider: provider_util.createProvider,
isProviderLiteral: provider_util.isProviderLiteral,
EMPTY_ARRAY: view_utils.EMPTY_ARRAY,
EMPTY_MAP: view_utils.EMPTY_MAP,
pureProxy1: view_utils.pureProxy1,
pureProxy2: view_utils.pureProxy2,
pureProxy3: view_utils.pureProxy3,
pureProxy4: view_utils.pureProxy4,
pureProxy5: view_utils.pureProxy5,
pureProxy6: view_utils.pureProxy6,
pureProxy7: view_utils.pureProxy7,
pureProxy8: view_utils.pureProxy8,
pureProxy9: view_utils.pureProxy9,
pureProxy10: view_utils.pureProxy10,
castByValue: view_utils.castByValue,
Console: console.Console,
};
//# sourceMappingURL=private_export.js.map
/***/ },
/* 381 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var application_tokens_1 = __webpack_require__(58);
var application_ref_1 = __webpack_require__(99);
var change_detection_1 = __webpack_require__(59);
var view_utils_1 = __webpack_require__(63);
var component_resolver_1 = __webpack_require__(40);
var dynamic_component_loader_1 = __webpack_require__(190);
var __unused; // avoid unused import when Type union types are erased
/**
* A default set of providers which should be included in any Angular
* application, regardless of the platform it runs onto.
*/
exports.APPLICATION_COMMON_PROVIDERS =
/*@ts2dart_const*/ [
application_ref_1.APPLICATION_CORE_PROVIDERS,
/* @ts2dart_Provider */ { provide: component_resolver_1.ComponentResolver, useClass: component_resolver_1.ReflectorComponentResolver },
application_tokens_1.APP_ID_RANDOM_PROVIDER,
view_utils_1.ViewUtils,
/* @ts2dart_Provider */ { provide: change_detection_1.IterableDiffers, useValue: change_detection_1.defaultIterableDiffers },
/* @ts2dart_Provider */ { provide: change_detection_1.KeyValueDiffers, useValue: change_detection_1.defaultKeyValueDiffers },
/* @ts2dart_Provider */ { provide: dynamic_component_loader_1.DynamicComponentLoader, useClass: dynamic_component_loader_1.DynamicComponentLoader_ }
];
//# sourceMappingURL=application_common_providers.js.map
/***/ },
/* 382 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
/**
* @module
* @description
* Change detection enables data binding in Angular.
*/
var change_detection_1 = __webpack_require__(59);
exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy;
exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef;
exports.WrappedValue = change_detection_1.WrappedValue;
exports.SimpleChange = change_detection_1.SimpleChange;
exports.DefaultIterableDiffer = change_detection_1.DefaultIterableDiffer;
exports.IterableDiffers = change_detection_1.IterableDiffers;
exports.KeyValueDiffers = change_detection_1.KeyValueDiffers;
exports.CollectionChangeRecord = change_detection_1.CollectionChangeRecord;
exports.KeyValueChangeRecord = change_detection_1.KeyValueChangeRecord;
//# sourceMappingURL=change_detection.js.map
/***/ },
/* 383 */
/***/ function(module, exports) {
"use strict";
var ChangeDetectorRef = (function () {
function ChangeDetectorRef() {
}
return ChangeDetectorRef;
}());
exports.ChangeDetectorRef = ChangeDetectorRef;
//# sourceMappingURL=change_detector_ref.js.map
/***/ },
/* 384 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var lang_1 = __webpack_require__(4);
var debug_node_1 = __webpack_require__(183);
var DebugDomRootRenderer = (function () {
function DebugDomRootRenderer(_delegate) {
this._delegate = _delegate;
}
DebugDomRootRenderer.prototype.renderComponent = function (componentProto) {
return new DebugDomRenderer(this._delegate.renderComponent(componentProto));
};
return DebugDomRootRenderer;
}());
exports.DebugDomRootRenderer = DebugDomRootRenderer;
var DebugDomRenderer = (function () {
function DebugDomRenderer(_delegate) {
this._delegate = _delegate;
}
DebugDomRenderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) {
var nativeEl = this._delegate.selectRootElement(selectorOrNode, debugInfo);
var debugEl = new debug_node_1.DebugElement(nativeEl, null, debugInfo);
debug_node_1.indexDebugNode(debugEl);
return nativeEl;
};
DebugDomRenderer.prototype.createElement = function (parentElement, name, debugInfo) {
var nativeEl = this._delegate.createElement(parentElement, name, debugInfo);
var debugEl = new debug_node_1.DebugElement(nativeEl, debug_node_1.getDebugNode(parentElement), debugInfo);
debugEl.name = name;
debug_node_1.indexDebugNode(debugEl);
return nativeEl;
};
DebugDomRenderer.prototype.createViewRoot = function (hostElement) { return this._delegate.createViewRoot(hostElement); };
DebugDomRenderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) {
var comment = this._delegate.createTemplateAnchor(parentElement, debugInfo);
var debugEl = new debug_node_1.DebugNode(comment, debug_node_1.getDebugNode(parentElement), debugInfo);
debug_node_1.indexDebugNode(debugEl);
return comment;
};
DebugDomRenderer.prototype.createText = function (parentElement, value, debugInfo) {
var text = this._delegate.createText(parentElement, value, debugInfo);
var debugEl = new debug_node_1.DebugNode(text, debug_node_1.getDebugNode(parentElement), debugInfo);
debug_node_1.indexDebugNode(debugEl);
return text;
};
DebugDomRenderer.prototype.projectNodes = function (parentElement, nodes) {
var debugParent = debug_node_1.getDebugNode(parentElement);
if (lang_1.isPresent(debugParent) && debugParent instanceof debug_node_1.DebugElement) {
var debugElement_1 = debugParent;
nodes.forEach(function (node) { debugElement_1.addChild(debug_node_1.getDebugNode(node)); });
}
this._delegate.projectNodes(parentElement, nodes);
};
DebugDomRenderer.prototype.attachViewAfter = function (node, viewRootNodes) {
var debugNode = debug_node_1.getDebugNode(node);
if (lang_1.isPresent(debugNode)) {
var debugParent = debugNode.parent;
if (viewRootNodes.length > 0 && lang_1.isPresent(debugParent)) {
var debugViewRootNodes = [];
viewRootNodes.forEach(function (rootNode) { return debugViewRootNodes.push(debug_node_1.getDebugNode(rootNode)); });
debugParent.insertChildrenAfter(debugNode, debugViewRootNodes);
}
}
this._delegate.attachViewAfter(node, viewRootNodes);
};
DebugDomRenderer.prototype.detachView = function (viewRootNodes) {
viewRootNodes.forEach(function (node) {
var debugNode = debug_node_1.getDebugNode(node);
if (lang_1.isPresent(debugNode) && lang_1.isPresent(debugNode.parent)) {
debugNode.parent.removeChild(debugNode);
}
});
this._delegate.detachView(viewRootNodes);
};
DebugDomRenderer.prototype.destroyView = function (hostElement, viewAllNodes) {
viewAllNodes.forEach(function (node) { debug_node_1.removeDebugNodeFromIndex(debug_node_1.getDebugNode(node)); });
this._delegate.destroyView(hostElement, viewAllNodes);
};
DebugDomRenderer.prototype.listen = function (renderElement, name, callback) {
var debugEl = debug_node_1.getDebugNode(renderElement);
if (lang_1.isPresent(debugEl)) {
debugEl.listeners.push(new debug_node_1.EventListener(name, callback));
}
return this._delegate.listen(renderElement, name, callback);
};
DebugDomRenderer.prototype.listenGlobal = function (target, name, callback) {
return this._delegate.listenGlobal(target, name, callback);
};
DebugDomRenderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
var debugEl = debug_node_1.getDebugNode(renderElement);
if (lang_1.isPresent(debugEl) && debugEl instanceof debug_node_1.DebugElement) {
debugEl.properties[propertyName] = propertyValue;
}
this._delegate.setElementProperty(renderElement, propertyName, propertyValue);
};
DebugDomRenderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) {
var debugEl = debug_node_1.getDebugNode(renderElement);
if (lang_1.isPresent(debugEl) && debugEl instanceof debug_node_1.DebugElement) {
debugEl.attributes[attributeName] = attributeValue;
}
this._delegate.setElementAttribute(renderElement, attributeName, attributeValue);
};
DebugDomRenderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) {
this._delegate.setBindingDebugInfo(renderElement, propertyName, propertyValue);
};
DebugDomRenderer.prototype.setElementClass = function (renderElement, className, isAdd) {
this._delegate.setElementClass(renderElement, className, isAdd);
};
DebugDomRenderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
this._delegate.setElementStyle(renderElement, styleName, styleValue);
};
DebugDomRenderer.prototype.invokeElementMethod = function (renderElement, methodName, args) {
this._delegate.invokeElementMethod(renderElement, methodName, args);
};
DebugDomRenderer.prototype.setText = function (renderNode, text) { this._delegate.setText(renderNode, text); };
return DebugDomRenderer;
}());
exports.DebugDomRenderer = DebugDomRenderer;
//# sourceMappingURL=debug_renderer.js.map
/***/ },
/* 385 */
/***/ function(module, exports) {
"use strict";
/**
* Creates a token that can be used in a DI Provider.
*
* ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview))
*
* ```typescript
* var t = new OpaqueToken("value");
*
* var injector = Injector.resolveAndCreate([
* provide(t, {useValue: "bindingValue"})
* ]);
*
* expect(injector.get(t)).toEqual("bindingValue");
* ```
*
* Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions
* caused by multiple providers using the same string as two different tokens.
*
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
* error messages.
* @ts2dart_const
*/
var OpaqueToken = (function () {
function OpaqueToken(_desc) {
this._desc = _desc;
}
OpaqueToken.prototype.toString = function () { return "Token " + this._desc; };
return OpaqueToken;
}());
exports.OpaqueToken = OpaqueToken;
//# sourceMappingURL=opaque_token.js.map
/***/ },
/* 386 */
74,
/* 387 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Public API for compiler
var component_resolver_1 = __webpack_require__(40);
exports.ComponentResolver = component_resolver_1.ComponentResolver;
var query_list_1 = __webpack_require__(389);
exports.QueryList = query_list_1.QueryList;
var dynamic_component_loader_1 = __webpack_require__(190);
exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader;
var element_ref_1 = __webpack_require__(191);
exports.ElementRef = element_ref_1.ElementRef;
var template_ref_1 = __webpack_require__(192);
exports.TemplateRef = template_ref_1.TemplateRef;
var view_ref_1 = __webpack_require__(194);
exports.EmbeddedViewRef = view_ref_1.EmbeddedViewRef;
exports.ViewRef = view_ref_1.ViewRef;
var view_container_ref_1 = __webpack_require__(193);
exports.ViewContainerRef = view_container_ref_1.ViewContainerRef;
var component_factory_1 = __webpack_require__(188);
exports.ComponentRef = component_factory_1.ComponentRef;
exports.ComponentFactory = component_factory_1.ComponentFactory;
var exceptions_1 = __webpack_require__(109);
exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException;
//# sourceMappingURL=linker.js.map
/***/ },
/* 388 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var injector_1 = __webpack_require__(103);
var _UNDEFINED = new Object();
var ElementInjector = (function (_super) {
__extends(ElementInjector, _super);
function ElementInjector(_view, _nodeIndex) {
_super.call(this);
this._view = _view;
this._nodeIndex = _nodeIndex;
}
ElementInjector.prototype.get = function (token, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = injector_1.THROW_IF_NOT_FOUND; }
var result = _UNDEFINED;
if (result === _UNDEFINED) {
result = this._view.injectorGet(token, this._nodeIndex, _UNDEFINED);
}
if (result === _UNDEFINED) {
result = this._view.parentInjector.get(token, notFoundValue);
}
return result;
};
return ElementInjector;
}(injector_1.Injector));
exports.ElementInjector = ElementInjector;
//# sourceMappingURL=element_injector.js.map
/***/ },
/* 389 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var collection_1 = __webpack_require__(11);
var lang_1 = __webpack_require__(4);
var async_1 = __webpack_require__(27);
/**
* An unmodifiable list of items that Angular keeps up to date when the state
* of the application changes.
*
* The type of object that {@link QueryMetadata} and {@link ViewQueryMetadata} provide.
*
* Implements an iterable interface, therefore it can be used in both ES6
* javascript `for (var i of items)` loops as well as in Angular templates with
* `*ngFor="let i of myList"`.
*
* Changes can be observed by subscribing to the changes `Observable`.
*
* NOTE: In the future this class will implement an `Observable` interface.
*
* ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview))
* ```typescript
* @Component({...})
* class Container {
* constructor(@Query(Item) items: QueryList- ) {
* items.changes.subscribe(_ => console.log(items.length));
* }
* }
* ```
*/
var QueryList = (function () {
function QueryList() {
this._dirty = true;
this._results = [];
this._emitter = new async_1.EventEmitter();
}
Object.defineProperty(QueryList.prototype, "changes", {
get: function () { return this._emitter; },
enumerable: true,
configurable: true
});
Object.defineProperty(QueryList.prototype, "length", {
get: function () { return this._results.length; },
enumerable: true,
configurable: true
});
Object.defineProperty(QueryList.prototype, "first", {
get: function () { return collection_1.ListWrapper.first(this._results); },
enumerable: true,
configurable: true
});
Object.defineProperty(QueryList.prototype, "last", {
get: function () { return collection_1.ListWrapper.last(this._results); },
enumerable: true,
configurable: true
});
/**
* returns a new array with the passed in function applied to each element.
*/
QueryList.prototype.map = function (fn) { return this._results.map(fn); };
/**
* returns a filtered array.
*/
QueryList.prototype.filter = function (fn) { return this._results.filter(fn); };
/**
* returns a reduced value.
*/
QueryList.prototype.reduce = function (fn, init) { return this._results.reduce(fn, init); };
/**
* executes function for each element in a query.
*/
QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); };
/**
* converts QueryList into an array
*/
QueryList.prototype.toArray = function () { return collection_1.ListWrapper.clone(this._results); };
QueryList.prototype[lang_1.getSymbolIterator()] = function () { return this._results[lang_1.getSymbolIterator()](); };
QueryList.prototype.toString = function () { return this._results.toString(); };
/**
* @internal
*/
QueryList.prototype.reset = function (res) {
this._results = collection_1.ListWrapper.flatten(res);
this._dirty = false;
};
/** @internal */
QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); };
/** internal */
QueryList.prototype.setDirty = function () { this._dirty = true; };
Object.defineProperty(QueryList.prototype, "dirty", {
/** internal */
get: function () { return this._dirty; },
enumerable: true,
configurable: true
});
return QueryList;
}());
exports.QueryList = QueryList;
//# sourceMappingURL=query_list.js.map
/***/ },
/* 390 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var collection_1 = __webpack_require__(11);
var element_1 = __webpack_require__(108);
var lang_1 = __webpack_require__(4);
var async_1 = __webpack_require__(27);
var view_ref_1 = __webpack_require__(194);
var view_type_1 = __webpack_require__(62);
var view_utils_1 = __webpack_require__(63);
var change_detection_1 = __webpack_require__(59);
var profile_1 = __webpack_require__(64);
var exceptions_1 = __webpack_require__(109);
var debug_context_1 = __webpack_require__(189);
var element_injector_1 = __webpack_require__(388);
var _scope_check = profile_1.wtfCreateScope("AppView#check(ascii id)");
/**
* Cost of making objects: http://jsperf.com/instantiate-size-of-object
*
*/
var AppView = (function () {
function AppView(clazz, componentType, type, viewUtils, parentInjector, declarationAppElement, cdMode) {
this.clazz = clazz;
this.componentType = componentType;
this.type = type;
this.viewUtils = viewUtils;
this.parentInjector = parentInjector;
this.declarationAppElement = declarationAppElement;
this.cdMode = cdMode;
this.contentChildren = [];
this.viewChildren = [];
this.viewContainerElement = null;
// The names of the below fields must be kept in sync with codegen_name_util.ts or
// change detection will fail.
this.cdState = change_detection_1.ChangeDetectorState.NeverChecked;
this.destroyed = false;
this.ref = new view_ref_1.ViewRef_(this);
if (type === view_type_1.ViewType.COMPONENT || type === view_type_1.ViewType.HOST) {
this.renderer = viewUtils.renderComponent(componentType);
}
else {
this.renderer = declarationAppElement.parentView.renderer;
}
}
AppView.prototype.create = function (context, givenProjectableNodes, rootSelectorOrNode) {
this.context = context;
var projectableNodes;
switch (this.type) {
case view_type_1.ViewType.COMPONENT:
projectableNodes = view_utils_1.ensureSlotCount(givenProjectableNodes, this.componentType.slotCount);
break;
case view_type_1.ViewType.EMBEDDED:
projectableNodes = this.declarationAppElement.parentView.projectableNodes;
break;
case view_type_1.ViewType.HOST:
// Note: Don't ensure the slot count for the projectableNodes as we store
// them only for the contained component view (which will later check the slot count...)
projectableNodes = givenProjectableNodes;
break;
}
this._hasExternalHostElement = lang_1.isPresent(rootSelectorOrNode);
this.projectableNodes = projectableNodes;
return this.createInternal(rootSelectorOrNode);
};
/**
* Overwritten by implementations.
* Returns the AppElement for the host element for ViewType.HOST.
*/
AppView.prototype.createInternal = function (rootSelectorOrNode) { return null; };
AppView.prototype.init = function (rootNodesOrAppElements, allNodes, disposables, subscriptions) {
this.rootNodesOrAppElements = rootNodesOrAppElements;
this.allNodes = allNodes;
this.disposables = disposables;
this.subscriptions = subscriptions;
if (this.type === view_type_1.ViewType.COMPONENT) {
// Note: the render nodes have been attached to their host element
// in the ViewFactory already.
this.declarationAppElement.parentView.viewChildren.push(this);
this.dirtyParentQueriesInternal();
}
};
AppView.prototype.selectOrCreateHostElement = function (elementName, rootSelectorOrNode, debugInfo) {
var hostElement;
if (lang_1.isPresent(rootSelectorOrNode)) {
hostElement = this.renderer.selectRootElement(rootSelectorOrNode, debugInfo);
}
else {
hostElement = this.renderer.createElement(null, elementName, debugInfo);
}
return hostElement;
};
AppView.prototype.injectorGet = function (token, nodeIndex, notFoundResult) {
return this.injectorGetInternal(token, nodeIndex, notFoundResult);
};
/**
* Overwritten by implementations
*/
AppView.prototype.injectorGetInternal = function (token, nodeIndex, notFoundResult) {
return notFoundResult;
};
AppView.prototype.injector = function (nodeIndex) {
if (lang_1.isPresent(nodeIndex)) {
return new element_injector_1.ElementInjector(this, nodeIndex);
}
else {
return this.parentInjector;
}
};
AppView.prototype.destroy = function () {
if (this._hasExternalHostElement) {
this.renderer.detachView(this.flatRootNodes);
}
else if (lang_1.isPresent(this.viewContainerElement)) {
this.viewContainerElement.detachView(this.viewContainerElement.nestedViews.indexOf(this));
}
this._destroyRecurse();
};
AppView.prototype._destroyRecurse = function () {
if (this.destroyed) {
return;
}
var children = this.contentChildren;
for (var i = 0; i < children.length; i++) {
children[i]._destroyRecurse();
}
children = this.viewChildren;
for (var i = 0; i < children.length; i++) {
children[i]._destroyRecurse();
}
this.destroyLocal();
this.destroyed = true;
};
AppView.prototype.destroyLocal = function () {
var hostElement = this.type === view_type_1.ViewType.COMPONENT ? this.declarationAppElement.nativeElement : null;
for (var i = 0; i < this.disposables.length; i++) {
this.disposables[i]();
}
for (var i = 0; i < this.subscriptions.length; i++) {
async_1.ObservableWrapper.dispose(this.subscriptions[i]);
}
this.destroyInternal();
if (this._hasExternalHostElement) {
this.renderer.detachView(this.flatRootNodes);
}
else if (lang_1.isPresent(this.viewContainerElement)) {
this.viewContainerElement.detachView(this.viewContainerElement.nestedViews.indexOf(this));
}
else {
this.dirtyParentQueriesInternal();
}
this.renderer.destroyView(hostElement, this.allNodes);
};
/**
* Overwritten by implementations
*/
AppView.prototype.destroyInternal = function () { };
Object.defineProperty(AppView.prototype, "changeDetectorRef", {
get: function () { return this.ref; },
enumerable: true,
configurable: true
});
Object.defineProperty(AppView.prototype, "parent", {
get: function () {
return lang_1.isPresent(this.declarationAppElement) ? this.declarationAppElement.parentView : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AppView.prototype, "flatRootNodes", {
get: function () { return view_utils_1.flattenNestedViewRenderNodes(this.rootNodesOrAppElements); },
enumerable: true,
configurable: true
});
Object.defineProperty(AppView.prototype, "lastRootNode", {
get: function () {
var lastNode = this.rootNodesOrAppElements.length > 0 ?
this.rootNodesOrAppElements[this.rootNodesOrAppElements.length - 1] :
null;
return _findLastRenderNode(lastNode);
},
enumerable: true,
configurable: true
});
/**
* Overwritten by implementations
*/
AppView.prototype.dirtyParentQueriesInternal = function () { };
AppView.prototype.detectChanges = function (throwOnChange) {
var s = _scope_check(this.clazz);
if (this.cdMode === change_detection_1.ChangeDetectionStrategy.Detached ||
this.cdMode === change_detection_1.ChangeDetectionStrategy.Checked ||
this.cdState === change_detection_1.ChangeDetectorState.Errored)
return;
if (this.destroyed) {
this.throwDestroyedError('detectChanges');
}
this.detectChangesInternal(throwOnChange);
if (this.cdMode === change_detection_1.ChangeDetectionStrategy.CheckOnce)
this.cdMode = change_detection_1.ChangeDetectionStrategy.Checked;
this.cdState = change_detection_1.ChangeDetectorState.CheckedBefore;
profile_1.wtfLeave(s);
};
/**
* Overwritten by implementations
*/
AppView.prototype.detectChangesInternal = function (throwOnChange) {
this.detectContentChildrenChanges(throwOnChange);
this.detectViewChildrenChanges(throwOnChange);
};
AppView.prototype.detectContentChildrenChanges = function (throwOnChange) {
for (var i = 0; i < this.contentChildren.length; ++i) {
this.contentChildren[i].detectChanges(throwOnChange);
}
};
AppView.prototype.detectViewChildrenChanges = function (throwOnChange) {
for (var i = 0; i < this.viewChildren.length; ++i) {
this.viewChildren[i].detectChanges(throwOnChange);
}
};
AppView.prototype.addToContentChildren = function (renderAppElement) {
renderAppElement.parentView.contentChildren.push(this);
this.viewContainerElement = renderAppElement;
this.dirtyParentQueriesInternal();
};
AppView.prototype.removeFromContentChildren = function (renderAppElement) {
collection_1.ListWrapper.remove(renderAppElement.parentView.contentChildren, this);
this.dirtyParentQueriesInternal();
this.viewContainerElement = null;
};
AppView.prototype.markAsCheckOnce = function () { this.cdMode = change_detection_1.ChangeDetectionStrategy.CheckOnce; };
AppView.prototype.markPathToRootAsCheckOnce = function () {
var c = this;
while (lang_1.isPresent(c) && c.cdMode !== change_detection_1.ChangeDetectionStrategy.Detached) {
if (c.cdMode === change_detection_1.ChangeDetectionStrategy.Checked) {
c.cdMode = change_detection_1.ChangeDetectionStrategy.CheckOnce;
}
var parentEl = c.type === view_type_1.ViewType.COMPONENT ? c.declarationAppElement : c.viewContainerElement;
c = lang_1.isPresent(parentEl) ? parentEl.parentView : null;
}
};
AppView.prototype.eventHandler = function (cb) { return cb; };
AppView.prototype.throwDestroyedError = function (details) { throw new exceptions_1.ViewDestroyedException(details); };
return AppView;
}());
exports.AppView = AppView;
var DebugAppView = (function (_super) {
__extends(DebugAppView, _super);
function DebugAppView(clazz, componentType, type, viewUtils, parentInjector, declarationAppElement, cdMode, staticNodeDebugInfos) {
_super.call(this, clazz, componentType, type, viewUtils, parentInjector, declarationAppElement, cdMode);
this.staticNodeDebugInfos = staticNodeDebugInfos;
this._currentDebugContext = null;
}
DebugAppView.prototype.create = function (context, givenProjectableNodes, rootSelectorOrNode) {
this._resetDebug();
try {
return _super.prototype.create.call(this, context, givenProjectableNodes, rootSelectorOrNode);
}
catch (e) {
this._rethrowWithContext(e, e.stack);
throw e;
}
};
DebugAppView.prototype.injectorGet = function (token, nodeIndex, notFoundResult) {
this._resetDebug();
try {
return _super.prototype.injectorGet.call(this, token, nodeIndex, notFoundResult);
}
catch (e) {
this._rethrowWithContext(e, e.stack);
throw e;
}
};
DebugAppView.prototype.destroyLocal = function () {
this._resetDebug();
try {
_super.prototype.destroyLocal.call(this);
}
catch (e) {
this._rethrowWithContext(e, e.stack);
throw e;
}
};
DebugAppView.prototype.detectChanges = function (throwOnChange) {
this._resetDebug();
try {
_super.prototype.detectChanges.call(this, throwOnChange);
}
catch (e) {
this._rethrowWithContext(e, e.stack);
throw e;
}
};
DebugAppView.prototype._resetDebug = function () { this._currentDebugContext = null; };
DebugAppView.prototype.debug = function (nodeIndex, rowNum, colNum) {
return this._currentDebugContext = new debug_context_1.DebugContext(this, nodeIndex, rowNum, colNum);
};
DebugAppView.prototype._rethrowWithContext = function (e, stack) {
if (!(e instanceof exceptions_1.ViewWrappedException)) {
if (!(e instanceof exceptions_1.ExpressionChangedAfterItHasBeenCheckedException)) {
this.cdState = change_detection_1.ChangeDetectorState.Errored;
}
if (lang_1.isPresent(this._currentDebugContext)) {
throw new exceptions_1.ViewWrappedException(e, stack, this._currentDebugContext);
}
}
};
DebugAppView.prototype.eventHandler = function (cb) {
var _this = this;
var superHandler = _super.prototype.eventHandler.call(this, cb);
return function (event) {
_this._resetDebug();
try {
return superHandler(event);
}
catch (e) {
_this._rethrowWithContext(e, e.stack);
throw e;
}
};
};
return DebugAppView;
}(AppView));
exports.DebugAppView = DebugAppView;
function _findLastRenderNode(node) {
var lastNode;
if (node instanceof element_1.AppElement) {
var appEl = node;
lastNode = appEl.nativeElement;
if (lang_1.isPresent(appEl.nestedViews)) {
// Note: Views might have no root nodes at all!
for (var i = appEl.nestedViews.length - 1; i >= 0; i--) {
var nestedView = appEl.nestedViews[i];
if (nestedView.rootNodesOrAppElements.length > 0) {
lastNode = _findLastRenderNode(nestedView.rootNodesOrAppElements[nestedView.rootNodesOrAppElements.length - 1]);
}
}
}
}
else {
lastNode = node;
}
return lastNode;
}
//# sourceMappingURL=view.js.map
/***/ },
/* 391 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
/**
* This indirection is needed to free up Component, etc symbols in the public API
* to be used by the decorator versions of these annotations.
*/
var di_1 = __webpack_require__(195);
exports.QueryMetadata = di_1.QueryMetadata;
exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata;
exports.ContentChildMetadata = di_1.ContentChildMetadata;
exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata;
exports.ViewQueryMetadata = di_1.ViewQueryMetadata;
exports.ViewChildMetadata = di_1.ViewChildMetadata;
exports.AttributeMetadata = di_1.AttributeMetadata;
var directives_1 = __webpack_require__(196);
exports.ComponentMetadata = directives_1.ComponentMetadata;
exports.DirectiveMetadata = directives_1.DirectiveMetadata;
exports.PipeMetadata = directives_1.PipeMetadata;
exports.InputMetadata = directives_1.InputMetadata;
exports.OutputMetadata = directives_1.OutputMetadata;
exports.HostBindingMetadata = directives_1.HostBindingMetadata;
exports.HostListenerMetadata = directives_1.HostListenerMetadata;
var view_1 = __webpack_require__(110);
exports.ViewMetadata = view_1.ViewMetadata;
exports.ViewEncapsulation = view_1.ViewEncapsulation;
var di_2 = __webpack_require__(195);
var directives_2 = __webpack_require__(196);
var view_2 = __webpack_require__(110);
var decorators_1 = __webpack_require__(66);
// TODO(alexeagle): remove the duplication of this doc. It is copied from ComponentMetadata.
/**
* Declare reusable UI building blocks for an application.
*
* Each Angular component requires a single `@Component` annotation. The `@Component`
* annotation specifies when a component is instantiated, and which properties and hostListeners it
* binds to.
*
* When a component is instantiated, Angular
* - creates a shadow DOM for the component.
* - loads the selected template into the shadow DOM.
* - creates all the injectable objects configured with `providers` and `viewProviders`.
*
* All template expressions and statements are then evaluated against the component instance.
*
* ## Lifecycle hooks
*
* When the component class implements some {@link ../../guide/lifecycle-hooks.html} the callbacks
* are called by the change detection at defined points in time during the life of the component.
*
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='component'}
*/
exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function (fn) { return fn.View = View; });
// TODO(alexeagle): remove the duplication of this doc. It is copied from DirectiveMetadata.
/**
* Directives allow you to attach behavior to elements in the DOM.
*
* {@link DirectiveMetadata}s with an embedded view are called {@link ComponentMetadata}s.
*
* A directive consists of a single directive annotation and a controller class. When the
* directive's `selector` matches
* elements in the DOM, the following steps occur:
*
* 1. For each directive, the `ElementInjector` attempts to resolve the directive's constructor
* arguments.
* 2. Angular instantiates directives for each matched element using `ElementInjector` in a
* depth-first order,
* as declared in the HTML.
*
* ## Understanding How Injection Works
*
* There are three stages of injection resolution.
* - *Pre-existing Injectors*:
* - The terminal {@link Injector} cannot resolve dependencies. It either throws an error or, if
* the dependency was
* specified as `@Optional`, returns `null`.
* - The platform injector resolves browser singleton resources, such as: cookies, title,
* location, and others.
* - *Component Injectors*: Each component instance has its own {@link Injector}, and they follow
* the same parent-child hierarchy
* as the component instances in the DOM.
* - *Element Injectors*: Each component instance has a Shadow DOM. Within the Shadow DOM each
* element has an `ElementInjector`
* which follow the same parent-child hierarchy as the DOM elements themselves.
*
* When a template is instantiated, it also must instantiate the corresponding directives in a
* depth-first order. The
* current `ElementInjector` resolves the constructor dependencies for each directive.
*
* Angular then resolves dependencies as follows, according to the order in which they appear in the
* {@link ViewMetadata}:
*
* 1. Dependencies on the current element
* 2. Dependencies on element injectors and their parents until it encounters a Shadow DOM boundary
* 3. Dependencies on component injectors and their parents until it encounters the root component
* 4. Dependencies on pre-existing injectors
*
*
* The `ElementInjector` can inject other directives, element-specific special objects, or it can
* delegate to the parent
* injector.
*
* To inject other directives, declare the constructor parameter as:
* - `directive:DirectiveType`: a directive on the current element only
* - `@Host() directive:DirectiveType`: any directive that matches the type between the current
* element and the
* Shadow DOM root.
* - `@Query(DirectiveType) query:QueryList`: A live collection of direct child
* directives.
* - `@QueryDescendants(DirectiveType) query:QueryList`: A live collection of any
* child directives.
*
* To inject element-specific special objects, declare the constructor parameter as:
* - `element: ElementRef` to obtain a reference to logical element in the view.
* - `viewContainer: ViewContainerRef` to control child template instantiation, for
* {@link DirectiveMetadata} directives only
* - `bindingPropagation: BindingPropagation` to control change detection in a more granular way.
*
* ### Example
*
* The following example demonstrates how dependency injection resolves constructor arguments in
* practice.
*
*
* Assume this HTML template:
*
* ```
*
* ```
*
* With the following `dependency` decorator and `SomeService` injectable class.
*
* ```
* @Injectable()
* class SomeService {
* }
*
* @Directive({
* selector: '[dependency]',
* inputs: [
* 'id: dependency'
* ]
* })
* class Dependency {
* id:string;
* }
* ```
*
* Let's step through the different ways in which `MyDirective` could be declared...
*
*
* ### No injection
*
* Here the constructor is declared with no arguments, therefore nothing is injected into
* `MyDirective`.
*
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor() {
* }
* }
* ```
*
* This directive would be instantiated with no dependencies.
*
*
* ### Component-level injection
*
* Directives can inject any injectable instance from the closest component injector or any of its
* parents.
*
* Here, the constructor declares a parameter, `someService`, and injects the `SomeService` type
* from the parent
* component's injector.
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor(someService: SomeService) {
* }
* }
* ```
*
* This directive would be instantiated with a dependency on `SomeService`.
*
*
* ### Injecting a directive from the current element
*
* Directives can inject other directives declared on the current element.
*
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor(dependency: Dependency) {
* expect(dependency.id).toEqual(3);
* }
* }
* ```
* This directive would be instantiated with `Dependency` declared at the same element, in this case
* `dependency="3"`.
*
* ### Injecting a directive from any ancestor elements
*
* Directives can inject other directives declared on any ancestor element (in the current Shadow
* DOM), i.e. on the current element, the
* parent element, or its parents.
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor(@Host() dependency: Dependency) {
* expect(dependency.id).toEqual(2);
* }
* }
* ```
*
* `@Host` checks the current element, the parent, as well as its parents recursively. If
* `dependency="2"` didn't
* exist on the direct parent, this injection would
* have returned
* `dependency="1"`.
*
*
* ### Injecting a live collection of direct child directives
*
*
* A directive can also query for other child directives. Since parent directives are instantiated
* before child directives, a directive can't simply inject the list of child directives. Instead,
* the directive injects a {@link QueryList}, which updates its contents as children are added,
* removed, or moved by a directive that uses a {@link ViewContainerRef} such as a `ngFor`, an
* `ngIf`, or an `ngSwitch`.
*
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor(@Query(Dependency) dependencies:QueryList) {
* }
* }
* ```
*
* This directive would be instantiated with a {@link QueryList} which contains `Dependency` 4 and
* 6. Here, `Dependency` 5 would not be included, because it is not a direct child.
*
* ### Injecting a live collection of descendant directives
*
* By passing the descendant flag to `@Query` above, we can include the children of the child
* elements.
*
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor(@Query(Dependency, {descendants: true}) dependencies:QueryList) {
* }
* }
* ```
*
* This directive would be instantiated with a Query which would contain `Dependency` 4, 5 and 6.
*
* ### Optional injection
*
* The normal behavior of directives is to return an error when a specified dependency cannot be
* resolved. If you
* would like to inject `null` on unresolved dependency instead, you can annotate that dependency
* with `@Optional()`.
* This explicitly permits the author of a template to treat some of the surrounding directives as
* optional.
*
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor(@Optional() dependency:Dependency) {
* }
* }
* ```
*
* This directive would be instantiated with a `Dependency` directive found on the current element.
* If none can be
* found, the injector supplies `null` instead of throwing an error.
*
* ### Example
*
* Here we use a decorator directive to simply define basic tool-tip behavior.
*
* ```
* @Directive({
* selector: '[tooltip]',
* inputs: [
* 'text: tooltip'
* ],
* host: {
* '(mouseenter)': 'onMouseEnter()',
* '(mouseleave)': 'onMouseLeave()'
* }
* })
* class Tooltip{
* text:string;
* overlay:Overlay; // NOT YET IMPLEMENTED
* overlayManager:OverlayManager; // NOT YET IMPLEMENTED
*
* constructor(overlayManager:OverlayManager) {
* this.overlay = overlay;
* }
*
* onMouseEnter() {
* // exact signature to be determined
* this.overlay = this.overlayManager.open(text, ...);
* }
*
* onMouseLeave() {
* this.overlay.close();
* this.overlay = null;
* }
* }
* ```
* In our HTML template, we can then add this behavior to a `
` or any other element with the
* `tooltip` selector,
* like so:
*
* ```
*
* ```
*
* Directives can also control the instantiation, destruction, and positioning of inline template
* elements:
*
* A directive uses a {@link ViewContainerRef} to instantiate, insert, move, and destroy views at
* runtime.
* The {@link ViewContainerRef} is created as a result of `
` element, and represents a
* location in the current view
* where these actions are performed.
*
* Views are always created as children of the current {@link ViewMetadata}, and as siblings of the
* `` element. Thus a
* directive in a child view cannot inject the directive that created it.
*
* Since directives that create views via ViewContainers are common in Angular, and using the full
* `` element syntax is wordy, Angular
* also supports a shorthand notation: `` and `` are
* equivalent.
*
* Thus,
*
* ```
*
* ```
*
* Expands in use to:
*
* ```
*
* ```
*
* Notice that although the shorthand places `*foo="bar"` within the `` element, the binding for
* the directive
* controller is correctly instantiated on the `` element rather than the `` element.
*
* ## Lifecycle hooks
*
* When the directive class implements some {@link ../../guide/lifecycle-hooks.html} the callbacks
* are called by the change detection at defined points in time during the life of the directive.
*
* ### Example
*
* Let's suppose we want to implement the `unless` behavior, to conditionally include a template.
*
* Here is a simple directive that triggers on an `unless` selector:
*
* ```
* @Directive({
* selector: '[unless]',
* inputs: ['unless']
* })
* export class Unless {
* viewContainer: ViewContainerRef;
* templateRef: TemplateRef;
* prevCondition: boolean;
*
* constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef) {
* this.viewContainer = viewContainer;
* this.templateRef = templateRef;
* this.prevCondition = null;
* }
*
* set unless(newCondition) {
* if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) {
* this.prevCondition = true;
* this.viewContainer.clear();
* } else if (!newCondition && (isBlank(this.prevCondition) || this.prevCondition)) {
* this.prevCondition = false;
* this.viewContainer.create(this.templateRef);
* }
* }
* }
* ```
*
* We can then use this `unless` selector in a template:
* ```
*
* ```
*
* Once the directive instantiates the child view, the shorthand notation for the template expands
* and the result is:
*
* ```
*
* ```
*
* Note also that although the `` template still exists inside the ``,
* the instantiated
* view occurs on the second `` which is a sibling to the `` element.
*/
exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewMetadata.
/**
* Metadata properties available for configuring Views.
*
* Each Angular component requires a single `@Component` and at least one `@View` annotation. The
* `@View` annotation specifies the HTML template to use, and lists the directives that are active
* within the template.
*
* When a component is instantiated, the template is loaded into the component's shadow root, and
* the expressions and statements in the template are evaluated against the component.
*
* For details on the `@Component` annotation, see {@link ComponentMetadata}.
*
* ### Example
*
* ```
* @Component({
* selector: 'greet',
* template: 'Hello {{name}}!',
* directives: [GreetUser, Bold]
* })
* class Greet {
* name: string;
*
* constructor() {
* this.name = 'World';
* }
* }
* ```
*/
var View = decorators_1.makeDecorator(view_2.ViewMetadata, function (fn) { return fn.View = View; });
/**
* Specifies that a constant attribute value should be injected.
*
* The directive can inject constant string literals of host element attributes.
*
* ### Example
*
* Suppose we have an `` element and want to know its `type`.
*
* ```html
*
* ```
*
* A decorator can inject string literal `text` like so:
*
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
*/
exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from QueryMetadata.
/**
* Declares an injectable parameter to be a live list of directives or variable
* bindings from the content children of a directive.
*
* ### Example ([live demo](http://plnkr.co/edit/lY9m8HLy7z06vDoUaSN2?p=preview))
*
* Assume that `` component would like to get a list its children ``
* components as shown in this example:
*
* ```html
*
* ...
* {{o.text}}
*
* ```
*
* The preferred solution is to query for `Pane` directives using this decorator.
*
* ```javascript
* @Component({
* selector: 'pane',
* inputs: ['title']
* })
* class Pane {
* title:string;
* }
*
* @Component({
* selector: 'tabs',
* template: `
*
*
* `
* })
* class Tabs {
* panes: QueryList;
* constructor(@Query(Pane) panes:QueryList) {
* this.panes = panes;
* }
* }
* ```
*
* A query can look for variable bindings by passing in a string with desired binding symbol.
*
* ### Example ([live demo](http://plnkr.co/edit/sT2j25cH1dURAyBRCKx1?p=preview))
* ```html
*
* ...
*
*
* @Component({ selector: 'seeker' })
* class seeker {
* constructor(@Query('findme') elList: QueryList) {...}
* }
* ```
*
* In this case the object that is injected depend on the type of the variable
* binding. It can be an ElementRef, a directive or a component.
*
* Passing in a comma separated list of variable bindings will query for all of them.
*
* ```html
*
* ...
* ...
*
*
* @Component({
* selector: 'seeker'
* })
* class Seeker {
* constructor(@Query('findMe, findMeToo') elList: QueryList) {...}
* }
* ```
*
* Configure whether query looks for direct children or all descendants
* of the querying element, by using the `descendants` parameter.
* It is set to `false` by default.
*
* ### Example ([live demo](http://plnkr.co/edit/wtGeB977bv7qvA5FTYl9?p=preview))
* ```html
*
* - a
* - b
*
* - c
*
*
* ```
*
* When querying for items, the first container will see only `a` and `b` by default,
* but with `Query(TextDirective, {descendants: true})` it will see `c` too.
*
* The queried directives are kept in a depth-first pre-order with respect to their
* positions in the DOM.
*
* Query does not look deep into any subcomponent views.
*
* Query is updated as part of the change-detection cycle. Since change detection
* happens after construction of a directive, QueryList will always be empty when observed in the
* constructor.
*
* The injected object is an unmodifiable live list.
* See {@link QueryList} for more details.
*/
exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildrenMetadata.
/**
* Configures a content query.
*
* Content queries are set before the `ngAfterContentInit` callback is called.
*
* ### Example
*
* ```
* @Directive({
* selector: 'someDir'
* })
* class SomeDir {
* @ContentChildren(ChildDirective) contentChildren: QueryList;
*
* ngAfterContentInit() {
* // contentChildren is set
* }
* }
* ```
*/
exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildMetadata.
/**
* Configures a content query.
*
* Content queries are set before the `ngAfterContentInit` callback is called.
*
* ### Example
*
* ```
* @Directive({
* selector: 'someDir'
* })
* class SomeDir {
* @ContentChild(ChildDirective) contentChild;
*
* ngAfterContentInit() {
* // contentChild is set
* }
* }
* ```
*/
exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildrenMetadata.
/**
* Declares a list of child element references.
*
* Angular automatically updates the list when the DOM is updated.
*
* `ViewChildren` takes a argument to select elements.
*
* - If the argument is a type, directives or components with the type will be bound.
*
* - If the argument is a string, the string is interpreted as a list of comma-separated selectors.
* For each selector, an element containing the matching template variable (e.g. `#child`) will be
* bound.
*
* View children are set before the `ngAfterViewInit` callback is called.
*
* ### Example
*
* With type selector:
*
* ```
* @Component({
* selector: 'child-cmp',
* template: 'child
'
* })
* class ChildCmp {
* doSomething() {}
* }
*
* @Component({
* selector: 'some-cmp',
* template: `
*
*
*
* `,
* directives: [ChildCmp]
* })
* class SomeCmp {
* @ViewChildren(ChildCmp) children:QueryList;
*
* ngAfterViewInit() {
* // children are set
* this.children.toArray().forEach((child)=>child.doSomething());
* }
* }
* ```
*
* With string selector:
*
* ```
* @Component({
* selector: 'child-cmp',
* template: 'child
'
* })
* class ChildCmp {
* doSomething() {}
* }
*
* @Component({
* selector: 'some-cmp',
* template: `
*
*
*
* `,
* directives: [ChildCmp]
* })
* class SomeCmp {
* @ViewChildren('child1,child2,child3') children:QueryList;
*
* ngAfterViewInit() {
* // children are set
* this.children.toArray().forEach((child)=>child.doSomething());
* }
* }
* ```
*
* See also: [ViewChildrenMetadata]
*/
exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildMetadata.
/**
* Declares a reference to a child element.
*
* `ViewChildren` takes a argument to select elements.
*
* - If the argument is a type, a directive or a component with the type will be bound.
*
* - If the argument is a string, the string is interpreted as a selector. An element containing the
* matching template variable (e.g. `#child`) will be bound.
*
* In either case, `@ViewChild()` assigns the first (looking from above) element if there are
* multiple matches.
*
* View child is set before the `ngAfterViewInit` callback is called.
*
* ### Example
*
* With type selector:
*
* ```
* @Component({
* selector: 'child-cmp',
* template: 'child
'
* })
* class ChildCmp {
* doSomething() {}
* }
*
* @Component({
* selector: 'some-cmp',
* template: '',
* directives: [ChildCmp]
* })
* class SomeCmp {
* @ViewChild(ChildCmp) child:ChildCmp;
*
* ngAfterViewInit() {
* // child is set
* this.child.doSomething();
* }
* }
* ```
*
* With string selector:
*
* ```
* @Component({
* selector: 'child-cmp',
* template: 'child
'
* })
* class ChildCmp {
* doSomething() {}
* }
*
* @Component({
* selector: 'some-cmp',
* template: '',
* directives: [ChildCmp]
* })
* class SomeCmp {
* @ViewChild('child') child:ChildCmp;
*
* ngAfterViewInit() {
* // child is set
* this.child.doSomething();
* }
* }
* ```
* See also: [ViewChildMetadata]
*/
exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewQueryMetadata.
/**
* Similar to {@link QueryMetadata}, but querying the component view, instead of
* the content children.
*
* ### Example ([live demo](http://plnkr.co/edit/eNsFHDf7YjyM6IzKxM1j?p=preview))
*
* ```javascript
* @Component({
* ...,
* template: `
* - a
* - b
* - c
* `
* })
* class MyComponent {
* shown: boolean;
*
* constructor(private @Query(Item) items:QueryList- ) {
* items.changes.subscribe(() => console.log(items.length));
* }
* }
* ```
*
* Supports the same querying parameters as {@link QueryMetadata}, except
* `descendants`. This always queries the whole view.
*
* As `shown` is flipped between true and false, items will contain zero of one
* items.
*
* Specifies that a {@link QueryList} should be injected.
*
* The injected object is an iterable and observable live list.
* See {@link QueryList} for more details.
*/
exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from PipeMetadata.
/**
* Declare reusable pipe function.
*
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='pipe'}
*/
exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from InputMetadata.
/**
* Declares a data-bound input property.
*
* Angular automatically updates data-bound properties during change detection.
*
* `InputMetadata` takes an optional parameter that specifies the name
* used when instantiating a component in the template. When not provided,
* the name of the decorated property is used.
*
* ### Example
*
* The following example creates a component with two input properties.
*
* ```typescript
* @Component({
* selector: 'bank-account',
* template: `
* Bank Name: {{bankName}}
* Account Id: {{id}}
* `
* })
* class BankAccount {
* @Input() bankName: string;
* @Input('account-id') id: string;
*
* // this property is not bound, and won't be automatically updated by Angular
* normalizedBankName: string;
* }
*
* @Component({
* selector: 'app',
* template: `
*
* `,
* directives: [BankAccount]
* })
* class App {}
*
* bootstrap(App);
* ```
*/
exports.Input = decorators_1.makePropDecorator(directives_2.InputMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from OutputMetadata.
/**
* Declares an event-bound output property.
*
* When an output property emits an event, an event handler attached to that event
* the template is invoked.
*
* `OutputMetadata` takes an optional parameter that specifies the name
* used when instantiating a component in the template. When not provided,
* the name of the decorated property is used.
*
* ### Example
*
* ```typescript
* @Directive({
* selector: 'interval-dir',
* })
* class IntervalDir {
* @Output() everySecond = new EventEmitter();
* @Output('everyFiveSeconds') five5Secs = new EventEmitter();
*
* constructor() {
* setInterval(() => this.everySecond.emit("event"), 1000);
* setInterval(() => this.five5Secs.emit("event"), 5000);
* }
* }
*
* @Component({
* selector: 'app',
* template: `
*
*
* `,
* directives: [IntervalDir]
* })
* class App {
* everySecond() { console.log('second'); }
* everyFiveSeconds() { console.log('five seconds'); }
* }
* bootstrap(App);
* ```
*/
exports.Output = decorators_1.makePropDecorator(directives_2.OutputMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from HostBindingMetadata.
/**
* Declares a host property binding.
*
* Angular automatically checks host property bindings during change detection.
* If a binding changes, it will update the host element of the directive.
*
* `HostBindingMetadata` takes an optional parameter that specifies the property
* name of the host element that will be updated. When not provided,
* the class property name is used.
*
* ### Example
*
* The following example creates a directive that sets the `valid` and `invalid` classes
* on the DOM element that has ngModel directive on it.
*
* ```typescript
* @Directive({selector: '[ngModel]'})
* class NgModelStatus {
* constructor(public control:NgModel) {}
* @HostBinding('[class.valid]') get valid { return this.control.valid; }
* @HostBinding('[class.invalid]') get invalid { return this.control.invalid; }
* }
*
* @Component({
* selector: 'app',
* template: ``,
* directives: [FORM_DIRECTIVES, NgModelStatus]
* })
* class App {
* prop;
* }
*
* bootstrap(App);
* ```
*/
exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata);
// TODO(alexeagle): remove the duplication of this doc. It is copied from HostListenerMetadata.
/**
* Declares a host listener.
*
* Angular will invoke the decorated method when the host element emits the specified event.
*
* If the decorated method returns `false`, then `preventDefault` is applied on the DOM
* event.
*
* ### Example
*
* The following example declares a directive that attaches a click listener to the button and
* counts clicks.
*
* ```typescript
* @Directive({selector: 'button[counting]'})
* class CountClicks {
* numberOfClicks = 0;
*
* @HostListener('click', ['$event.target'])
* onClick(btn) {
* console.log("button", btn, "number of clicks:", this.numberOfClicks++);
* }
* }
*
* @Component({
* selector: 'app',
* template: ``,
* directives: [CountClicks]
* })
* class App {}
*
* bootstrap(App);
* ```
*/
exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata);
//# sourceMappingURL=metadata.js.map
/***/ },
/* 392 */
/***/ function(module, exports) {
"use strict";
(function (LifecycleHooks) {
LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit";
LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy";
LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck";
LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges";
LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit";
LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked";
LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit";
LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked";
})(exports.LifecycleHooks || (exports.LifecycleHooks = {}));
var LifecycleHooks = exports.LifecycleHooks;
/**
* @internal
*/
exports.LIFECYCLE_HOOKS_VALUES = [
LifecycleHooks.OnInit,
LifecycleHooks.OnDestroy,
LifecycleHooks.DoCheck,
LifecycleHooks.OnChanges,
LifecycleHooks.AfterContentInit,
LifecycleHooks.AfterContentChecked,
LifecycleHooks.AfterViewInit,
LifecycleHooks.AfterViewChecked
];
//# sourceMappingURL=lifecycle_hooks.js.map
/***/ },
/* 393 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var console_1 = __webpack_require__(102);
var reflection_1 = __webpack_require__(65);
var reflector_reader_1 = __webpack_require__(111);
var testability_1 = __webpack_require__(113);
var application_ref_1 = __webpack_require__(99);
function _reflector() {
return reflection_1.reflector;
}
var __unused; // prevent missing use Dart warning.
/**
* A default set of providers which should be included in any Angular platform.
*/
exports.PLATFORM_COMMON_PROVIDERS = [
application_ref_1.PLATFORM_CORE_PROVIDERS,
/*@ts2dart_Provider*/ { provide: reflection_1.Reflector, useFactory: _reflector, deps: [] },
/*@ts2dart_Provider*/ { provide: reflector_reader_1.ReflectorReader, useExisting: reflection_1.Reflector },
testability_1.TestabilityRegistry,
console_1.Console
];
//# sourceMappingURL=platform_common_providers.js.map
/***/ },
/* 394 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var di_1 = __webpack_require__(32);
/**
* A token that can be provided when bootstraping an application to make an array of directives
* available in every component of the application.
*
* ### Example
*
* ```typescript
* import {PLATFORM_DIRECTIVES} from '@angular/core';
* import {OtherDirective} from './myDirectives';
*
* @Component({
* selector: 'my-component',
* template: `
*
*
* `
* })
* export class MyComponent {
* ...
* }
*
* bootstrap(MyComponent, [provide(PLATFORM_DIRECTIVES, {useValue: [OtherDirective], multi:true})]);
* ```
*/
exports.PLATFORM_DIRECTIVES =
/*@ts2dart_const*/ new di_1.OpaqueToken("Platform Directives");
/**
* A token that can be provided when bootstraping an application to make an array of pipes
* available in every component of the application.
*
* ### Example
*
* ```typescript
* import {PLATFORM_PIPES} from '@angular/core';
* import {OtherPipe} from './myPipe';
*
* @Component({
* selector: 'my-component',
* template: `
* {{123 | other-pipe}}
* `
* })
* export class MyComponent {
* ...
* }
*
* bootstrap(MyComponent, [provide(PLATFORM_PIPES, {useValue: [OtherPipe], multi:true})]);
* ```
*/
exports.PLATFORM_PIPES = new di_1.OpaqueToken("Platform Pipes");
//# sourceMappingURL=platform_directives_and_pipes.js.map
/***/ },
/* 395 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var lang_1 = __webpack_require__(4);
var trace;
var events;
function detectWTF() {
var wtf = lang_1.global['wtf'];
if (wtf) {
trace = wtf['trace'];
if (trace) {
events = trace['events'];
return true;
}
}
return false;
}
exports.detectWTF = detectWTF;
function createScope(signature, flags) {
if (flags === void 0) { flags = null; }
return events.createScope(signature, flags);
}
exports.createScope = createScope;
function leave(scope, returnValue) {
trace.leaveScope(scope, returnValue);
return returnValue;
}
exports.leave = leave;
function startTimeRange(rangeType, action) {
return trace.beginTimeRange(rangeType, action);
}
exports.startTimeRange = startTimeRange;
function endTimeRange(range) {
trace.endTimeRange(range);
}
exports.endTimeRange = endTimeRange;
//# sourceMappingURL=wtf_impl.js.map
/***/ },
/* 396 */
/***/ function(module, exports) {
"use strict";
/**
* This is here because DART requires it. It is noop in JS.
*/
function wtfInit() { }
exports.wtfInit = wtfInit;
//# sourceMappingURL=wtf_init.js.map
/***/ },
/* 397 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Public API for render
var api_1 = __webpack_require__(112);
exports.RootRenderer = api_1.RootRenderer;
exports.Renderer = api_1.Renderer;
exports.RenderComponentType = api_1.RenderComponentType;
//# sourceMappingURL=render.js.map
/***/ },
/* 398 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Public API for util
var decorators_1 = __webpack_require__(66);
exports.Class = decorators_1.Class;
//# sourceMappingURL=util.js.map
/***/ },
/* 399 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// Public API for Zone
var ng_zone_1 = __webpack_require__(114);
exports.NgZone = ng_zone_1.NgZone;
exports.NgZoneError = ng_zone_1.NgZoneError;
//# sourceMappingURL=zone.js.map
/***/ },
/* 400 */,
/* 401 */,
/* 402 */,
/* 403 */,
/* 404 */,
/* 405 */,
/* 406 */,
/* 407 */,
/* 408 */,
/* 409 */,
/* 410 */,
/* 411 */,
/* 412 */,
/* 413 */,
/* 414 */,
/* 415 */,
/* 416 */,
/* 417 */,
/* 418 */,
/* 419 */,
/* 420 */,
/* 421 */,
/* 422 */,
/* 423 */
/***/ function(module, exports, __webpack_require__) {
var require;var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(process, global, module) {/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
* @version 3.1.2
*/
(function() {
"use strict";
function lib$es6$promise$utils$$objectOrFunction(x) {
return typeof x === 'function' || (typeof x === 'object' && x !== null);
}
function lib$es6$promise$utils$$isFunction(x) {
return typeof x === 'function';
}
function lib$es6$promise$utils$$isMaybeThenable(x) {
return typeof x === 'object' && x !== null;
}
var lib$es6$promise$utils$$_isArray;
if (!Array.isArray) {
lib$es6$promise$utils$$_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
lib$es6$promise$utils$$_isArray = Array.isArray;
}
var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
var lib$es6$promise$asap$$len = 0;
var lib$es6$promise$asap$$vertxNext;
var lib$es6$promise$asap$$customSchedulerFn;
var lib$es6$promise$asap$$asap = function asap(callback, arg) {
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
lib$es6$promise$asap$$len += 2;
if (lib$es6$promise$asap$$len === 2) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if (lib$es6$promise$asap$$customSchedulerFn) {
lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
} else {
lib$es6$promise$asap$$scheduleFlush();
}
}
}
function lib$es6$promise$asap$$setScheduler(scheduleFn) {
lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
}
function lib$es6$promise$asap$$setAsap(asapFn) {
lib$es6$promise$asap$$asap = asapFn;
}
var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
// test for web worker but not in IE10
var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
typeof importScripts !== 'undefined' &&
typeof MessageChannel !== 'undefined';
// node
function lib$es6$promise$asap$$useNextTick() {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function() {
process.nextTick(lib$es6$promise$asap$$flush);
};
}
// vertx
function lib$es6$promise$asap$$useVertxTimer() {
return function() {
lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
};
}
function lib$es6$promise$asap$$useMutationObserver() {
var iterations = 0;
var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
// web worker
function lib$es6$promise$asap$$useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = lib$es6$promise$asap$$flush;
return function () {
channel.port2.postMessage(0);
};
}
function lib$es6$promise$asap$$useSetTimeout() {
return function() {
setTimeout(lib$es6$promise$asap$$flush, 1);
};
}
var lib$es6$promise$asap$$queue = new Array(1000);
function lib$es6$promise$asap$$flush() {
for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
var callback = lib$es6$promise$asap$$queue[i];
var arg = lib$es6$promise$asap$$queue[i+1];
callback(arg);
lib$es6$promise$asap$$queue[i] = undefined;
lib$es6$promise$asap$$queue[i+1] = undefined;
}
lib$es6$promise$asap$$len = 0;
}
function lib$es6$promise$asap$$attemptVertx() {
try {
var r = require;
var vertx = __webpack_require__(458);
lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
return lib$es6$promise$asap$$useVertxTimer();
} catch(e) {
return lib$es6$promise$asap$$useSetTimeout();
}
}
var lib$es6$promise$asap$$scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (lib$es6$promise$asap$$isNode) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
} else if (lib$es6$promise$asap$$BrowserMutationObserver) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
} else if (lib$es6$promise$asap$$isWorker) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
} else if (lib$es6$promise$asap$$browserWindow === undefined && "function" === 'function') {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();
} else {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
}
function lib$es6$promise$then$$then(onFulfillment, onRejection) {
var parent = this;
var state = parent._state;
if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
return this;
}
var child = new this.constructor(lib$es6$promise$$internal$$noop);
var result = parent._result;
if (state) {
var callback = arguments[state - 1];
lib$es6$promise$asap$$asap(function(){
lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
});
} else {
lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
}
return child;
}
var lib$es6$promise$then$$default = lib$es6$promise$then$$then;
function lib$es6$promise$promise$resolve$$resolve(object) {
/*jshint validthis:true */
var Constructor = this;
if (object && typeof object === 'object' && object.constructor === Constructor) {
return object;
}
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$resolve(promise, object);
return promise;
}
var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
function lib$es6$promise$$internal$$noop() {}
var lib$es6$promise$$internal$$PENDING = void 0;
var lib$es6$promise$$internal$$FULFILLED = 1;
var lib$es6$promise$$internal$$REJECTED = 2;
var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$selfFulfillment() {
return new TypeError("You cannot resolve a promise with itself");
}
function lib$es6$promise$$internal$$cannotReturnOwn() {
return new TypeError('A promises callback cannot return that same promise.');
}
function lib$es6$promise$$internal$$getThen(promise) {
try {
return promise.then;
} catch(error) {
lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
return lib$es6$promise$$internal$$GET_THEN_ERROR;
}
}
function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
try {
then.call(value, fulfillmentHandler, rejectionHandler);
} catch(e) {
return e;
}
}
function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
lib$es6$promise$asap$$asap(function(promise) {
var sealed = false;
var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
if (sealed) { return; }
sealed = true;
if (thenable !== value) {
lib$es6$promise$$internal$$resolve(promise, value);
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}, function(reason) {
if (sealed) { return; }
sealed = true;
lib$es6$promise$$internal$$reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
lib$es6$promise$$internal$$reject(promise, error);
}
}, promise);
}
function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, thenable._result);
} else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, thenable._result);
} else {
lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
lib$es6$promise$$internal$$resolve(promise, value);
}, function(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
}
}
function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {
if (maybeThenable.constructor === promise.constructor &&
then === lib$es6$promise$then$$default &&
constructor.resolve === lib$es6$promise$promise$resolve$$default) {
lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
} else {
if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
} else if (then === undefined) {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
} else if (lib$es6$promise$utils$$isFunction(then)) {
lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
} else {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
}
}
}
function lib$es6$promise$$internal$$resolve(promise, value) {
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());
} else if (lib$es6$promise$utils$$objectOrFunction(value)) {
lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}
function lib$es6$promise$$internal$$publishRejection(promise) {
if (promise._onerror) {
promise._onerror(promise._result);
}
lib$es6$promise$$internal$$publish(promise);
}
function lib$es6$promise$$internal$$fulfill(promise, value) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
promise._result = value;
promise._state = lib$es6$promise$$internal$$FULFILLED;
if (promise._subscribers.length !== 0) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
}
}
function lib$es6$promise$$internal$$reject(promise, reason) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
promise._state = lib$es6$promise$$internal$$REJECTED;
promise._result = reason;
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
}
function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
parent._onerror = null;
subscribers[length] = child;
subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
if (length === 0 && parent._state) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
}
}
function lib$es6$promise$$internal$$publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
if (subscribers.length === 0) { return; }
var child, callback, detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
if (child) {
lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
} else {
callback(detail);
}
}
promise._subscribers.length = 0;
}
function lib$es6$promise$$internal$$ErrorObject() {
this.error = null;
}
var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$tryCatch(callback, detail) {
try {
return callback(detail);
} catch(e) {
lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
}
}
function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
var hasCallback = lib$es6$promise$utils$$isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
value = lib$es6$promise$$internal$$tryCatch(callback, detail);
if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
failed = true;
error = value.error;
value = null;
} else {
succeeded = true;
}
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
return;
}
} else {
value = detail;
succeeded = true;
}
if (promise._state !== lib$es6$promise$$internal$$PENDING) {
// noop
} else if (hasCallback && succeeded) {
lib$es6$promise$$internal$$resolve(promise, value);
} else if (failed) {
lib$es6$promise$$internal$$reject(promise, error);
} else if (settled === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, value);
} else if (settled === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
}
}
function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value){
lib$es6$promise$$internal$$resolve(promise, value);
}, function rejectPromise(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
} catch(e) {
lib$es6$promise$$internal$$reject(promise, e);
}
}
function lib$es6$promise$promise$all$$all(entries) {
return new lib$es6$promise$enumerator$$default(this, entries).promise;
}
var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
function lib$es6$promise$promise$race$$race(entries) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(lib$es6$promise$$internal$$noop);
if (!lib$es6$promise$utils$$isArray(entries)) {
lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
return promise;
}
var length = entries.length;
function onFulfillment(value) {
lib$es6$promise$$internal$$resolve(promise, value);
}
function onRejection(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
}
for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
}
return promise;
}
var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
function lib$es6$promise$promise$reject$$reject(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$reject(promise, reason);
return promise;
}
var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
var lib$es6$promise$promise$$counter = 0;
function lib$es6$promise$promise$$needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function lib$es6$promise$promise$$needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
A promise can be in one of three states: pending, fulfilled, or rejected.
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
Basic Usage:
------------
```js
var promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
// on failure
reject(reason);
});
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Advanced Usage:
---------------
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
}
}
};
});
}
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Unlike callbacks, promises are great composable primitives.
```js
Promise.all([
getJSON('/posts'),
getJSON('/comments')
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
return values;
});
```
@class Promise
@param {function} resolver
Useful for tooling.
@constructor
*/
function lib$es6$promise$promise$$Promise(resolver) {
this._id = lib$es6$promise$promise$$counter++;
this._state = undefined;
this._result = undefined;
this._subscribers = [];
if (lib$es6$promise$$internal$$noop !== resolver) {
typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();
this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();
}
}
lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
lib$es6$promise$promise$$Promise.prototype = {
constructor: lib$es6$promise$promise$$Promise,
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
}, function(reason){
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
}, function (reason) {
return 'default name';
}).then(function (userName) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
throw new Error('`findUser` rejected and we're unhappy');
}).then(function (value) {
// never reached
}, function (reason) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
}).then(function (value) {
// never reached
}).then(function (value) {
// never reached
}, function (reason) {
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
}, function (reason) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
var result;
try {
result = findResult();
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
// failure
} else {
// success
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
}, function(reason){
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
var author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
// failure
} else {
try {
findBoooksByAuthor(author, function(books, err) {
if (err) {
failure(err);
} else {
try {
foundBooks(books);
} catch(reason) {
failure(reason);
}
}
});
} catch(error) {
failure(err);
}
// success
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
then(function(books){
// found books
}).catch(function(reason){
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
then: lib$es6$promise$then$$default,
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
this._instanceConstructor = Constructor;
this.promise = new Constructor(lib$es6$promise$$internal$$noop);
if (Array.isArray(input)) {
this._input = input;
this.length = input.length;
this._remaining = input.length;
this._result = new Array(this.length);
if (this.length === 0) {
lib$es6$promise$$internal$$fulfill(this.promise, this._result);
} else {
this.length = this.length || 0;
this._enumerate();
if (this._remaining === 0) {
lib$es6$promise$$internal$$fulfill(this.promise, this._result);
}
}
} else {
lib$es6$promise$$internal$$reject(this.promise, this._validationError());
}
}
lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
return new Error('Array Methods must be provided an Array');
};
lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
var length = this.length;
var input = this._input;
for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
this._eachEntry(input[i], i);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
var c = this._instanceConstructor;
var resolve = c.resolve;
if (resolve === lib$es6$promise$promise$resolve$$default) {
var then = lib$es6$promise$$internal$$getThen(entry);
if (then === lib$es6$promise$then$$default &&
entry._state !== lib$es6$promise$$internal$$PENDING) {
this._settledAt(entry._state, i, entry._result);
} else if (typeof then !== 'function') {
this._remaining--;
this._result[i] = entry;
} else if (c === lib$es6$promise$promise$$default) {
var promise = new c(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);
this._willSettleAt(promise, i);
} else {
this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);
}
} else {
this._willSettleAt(resolve(entry), i);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
var promise = this.promise;
if (promise._state === lib$es6$promise$$internal$$PENDING) {
this._remaining--;
if (state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
} else {
this._result[i] = value;
}
}
if (this._remaining === 0) {
lib$es6$promise$$internal$$fulfill(promise, this._result);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
var enumerator = this;
lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
}, function(reason) {
enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
});
};
function lib$es6$promise$polyfill$$polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof self !== 'undefined') {
local = self;
} else {
try {
local = Function('return this')();
} catch (e) {
throw new Error('polyfill failed because global object is unavailable in this environment');
}
}
var P = local.Promise;
if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
return;
}
local.Promise = lib$es6$promise$promise$$default;
}
var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
var lib$es6$promise$umd$$ES6Promise = {
'Promise': lib$es6$promise$promise$$default,
'polyfill': lib$es6$promise$polyfill$$default
};
/* global define:true module:true window: true */
if ("function" === 'function' && __webpack_require__(456)['amd']) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return lib$es6$promise$umd$$ES6Promise; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = lib$es6$promise$umd$$ES6Promise;
} else if (typeof this !== 'undefined') {
this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
}
lib$es6$promise$polyfill$$default();
}).call(this);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(133), (function() { return this; }()), __webpack_require__(141)(module)))
/***/ },
/* 424 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, process) { /*!
* https://github.com/paulmillr/es6-shim
* @license es6-shim Copyright 2013-2016 by Paul Miller (http://paulmillr.com)
* and contributors, MIT License
* es6-shim: v0.35.0
* see https://github.com/paulmillr/es6-shim/blob/0.35.0/LICENSE
* Details and documentation:
* https://github.com/paulmillr/es6-shim/
*/
// UMD (Universal Module Definition)
// see https://github.com/umdjs/umd/blob/master/returnExports.js
(function (root, factory) {
/*global define, module, exports */
if (true) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
}
}(this, function () {
'use strict';
var _apply = Function.call.bind(Function.apply);
var _call = Function.call.bind(Function.call);
var isArray = Array.isArray;
var keys = Object.keys;
var not = function notThunker(func) {
return function notThunk() { return !_apply(func, this, arguments); };
};
var throwsError = function (func) {
try {
func();
return false;
} catch (e) {
return true;
}
};
var valueOrFalseIfThrows = function valueOrFalseIfThrows(func) {
try {
return func();
} catch (e) {
return false;
}
};
var isCallableWithoutNew = not(throwsError);
var arePropertyDescriptorsSupported = function () {
// if Object.defineProperty exists but throws, it's IE 8
return !throwsError(function () { Object.defineProperty({}, 'x', { get: function () {} }); });
};
var supportsDescriptors = !!Object.defineProperty && arePropertyDescriptorsSupported();
var functionsHaveNames = (function foo() {}).name === 'foo';
var _forEach = Function.call.bind(Array.prototype.forEach);
var _reduce = Function.call.bind(Array.prototype.reduce);
var _filter = Function.call.bind(Array.prototype.filter);
var _some = Function.call.bind(Array.prototype.some);
var defineProperty = function (object, name, value, force) {
if (!force && name in object) { return; }
if (supportsDescriptors) {
Object.defineProperty(object, name, {
configurable: true,
enumerable: false,
writable: true,
value: value
});
} else {
object[name] = value;
}
};
// Define configurable, writable and non-enumerable props
// if they don’t exist.
var defineProperties = function (object, map, forceOverride) {
_forEach(keys(map), function (name) {
var method = map[name];
defineProperty(object, name, method, !!forceOverride);
});
};
var _toString = Function.call.bind(Object.prototype.toString);
var isCallable = false ? function IsCallableSlow(x) {
// Some old browsers (IE, FF) say that typeof /abc/ === 'function'
return typeof x === 'function' && _toString(x) === '[object Function]';
} : function IsCallableFast(x) { return typeof x === 'function'; };
var Value = {
getter: function (object, name, getter) {
if (!supportsDescriptors) {
throw new TypeError('getters require true ES5 support');
}
Object.defineProperty(object, name, {
configurable: true,
enumerable: false,
get: getter
});
},
proxy: function (originalObject, key, targetObject) {
if (!supportsDescriptors) {
throw new TypeError('getters require true ES5 support');
}
var originalDescriptor = Object.getOwnPropertyDescriptor(originalObject, key);
Object.defineProperty(targetObject, key, {
configurable: originalDescriptor.configurable,
enumerable: originalDescriptor.enumerable,
get: function getKey() { return originalObject[key]; },
set: function setKey(value) { originalObject[key] = value; }
});
},
redefine: function (object, property, newValue) {
if (supportsDescriptors) {
var descriptor = Object.getOwnPropertyDescriptor(object, property);
descriptor.value = newValue;
Object.defineProperty(object, property, descriptor);
} else {
object[property] = newValue;
}
},
defineByDescriptor: function (object, property, descriptor) {
if (supportsDescriptors) {
Object.defineProperty(object, property, descriptor);
} else if ('value' in descriptor) {
object[property] = descriptor.value;
}
},
preserveToString: function (target, source) {
if (source && isCallable(source.toString)) {
defineProperty(target, 'toString', source.toString.bind(source), true);
}
}
};
// Simple shim for Object.create on ES3 browsers
// (unlike real shim, no attempt to support `prototype === null`)
var create = Object.create || function (prototype, properties) {
var Prototype = function Prototype() {};
Prototype.prototype = prototype;
var object = new Prototype();
if (typeof properties !== 'undefined') {
keys(properties).forEach(function (key) {
Value.defineByDescriptor(object, key, properties[key]);
});
}
return object;
};
var supportsSubclassing = function (C, f) {
if (!Object.setPrototypeOf) { return false; /* skip test on IE < 11 */ }
return valueOrFalseIfThrows(function () {
var Sub = function Subclass(arg) {
var o = new C(arg);
Object.setPrototypeOf(o, Subclass.prototype);
return o;
};
Object.setPrototypeOf(Sub, C);
Sub.prototype = create(C.prototype, {
constructor: { value: Sub }
});
return f(Sub);
});
};
var getGlobal = function () {
/* global self, window, global */
// the only reliable means to get the global object is
// `Function('return this')()`
// However, this causes CSP violations in Chrome apps.
if (typeof self !== 'undefined') { return self; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
throw new Error('unable to locate global object');
};
var globals = getGlobal();
var globalIsFinite = globals.isFinite;
var _indexOf = Function.call.bind(String.prototype.indexOf);
var _arrayIndexOfApply = Function.apply.bind(Array.prototype.indexOf);
var _concat = Function.call.bind(Array.prototype.concat);
var _sort = Function.call.bind(Array.prototype.sort);
var _strSlice = Function.call.bind(String.prototype.slice);
var _push = Function.call.bind(Array.prototype.push);
var _pushApply = Function.apply.bind(Array.prototype.push);
var _shift = Function.call.bind(Array.prototype.shift);
var _max = Math.max;
var _min = Math.min;
var _floor = Math.floor;
var _abs = Math.abs;
var _log = Math.log;
var _sqrt = Math.sqrt;
var _hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
var ArrayIterator; // make our implementation private
var noop = function () {};
var Symbol = globals.Symbol || {};
var symbolSpecies = Symbol.species || '@@species';
var numberIsNaN = Number.isNaN || function isNaN(value) {
// NaN !== NaN, but they are identical.
// NaNs are the only non-reflexive value, i.e., if x !== x,
// then x is NaN.
// isNaN is broken: it converts its argument to number, so
// isNaN('foo') => true
return value !== value;
};
var numberIsFinite = Number.isFinite || function isFinite(value) {
return typeof value === 'number' && globalIsFinite(value);
};
// taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js
// can be replaced with require('is-arguments') if we ever use a build process instead
var isStandardArguments = function isArguments(value) {
return _toString(value) === '[object Arguments]';
};
var isLegacyArguments = function isArguments(value) {
return value !== null &&
typeof value === 'object' &&
typeof value.length === 'number' &&
value.length >= 0 &&
_toString(value) !== '[object Array]' &&
_toString(value.callee) === '[object Function]';
};
var isArguments = isStandardArguments(arguments) ? isStandardArguments : isLegacyArguments;
var Type = {
primitive: function (x) { return x === null || (typeof x !== 'function' && typeof x !== 'object'); },
object: function (x) { return x !== null && typeof x === 'object'; },
string: function (x) { return _toString(x) === '[object String]'; },
regex: function (x) { return _toString(x) === '[object RegExp]'; },
symbol: function (x) {
return typeof globals.Symbol === 'function' && typeof x === 'symbol';
}
};
var overrideNative = function overrideNative(object, property, replacement) {
var original = object[property];
defineProperty(object, property, replacement, true);
Value.preserveToString(object[property], original);
};
var hasSymbols = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' && Type.symbol(Symbol());
// This is a private name in the es6 spec, equal to '[Symbol.iterator]'
// we're going to use an arbitrary _-prefixed name to make our shims
// work properly with each other, even though we don't have full Iterator
// support. That is, `Array.from(map.keys())` will work, but we don't
// pretend to export a "real" Iterator interface.
var $iterator$ = Type.symbol(Symbol.iterator) ? Symbol.iterator : '_es6-shim iterator_';
// Firefox ships a partial implementation using the name @@iterator.
// https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
// So use that name if we detect it.
if (globals.Set && typeof new globals.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
// Reflect
if (!globals.Reflect) {
defineProperty(globals, 'Reflect', {}, true);
}
var Reflect = globals.Reflect;
var $String = String;
var ES = {
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args
Call: function Call(F, V) {
var args = arguments.length > 2 ? arguments[2] : [];
if (!ES.IsCallable(F)) {
throw new TypeError(F + ' is not a function');
}
return _apply(F, V, args);
},
RequireObjectCoercible: function (x, optMessage) {
/* jshint eqnull:true */
if (x == null) {
throw new TypeError(optMessage || 'Cannot call method on ' + x);
}
return x;
},
// This might miss the "(non-standard exotic and does not implement
// [[Call]])" case from
// http://www.ecma-international.org/ecma-262/6.0/#sec-typeof-operator-runtime-semantics-evaluation
// but we can't find any evidence these objects exist in practice.
// If we find some in the future, you could test `Object(x) === x`,
// which is reliable according to
// http://www.ecma-international.org/ecma-262/6.0/#sec-toobject
// but is not well optimized by runtimes and creates an object
// whenever it returns false, and thus is very slow.
TypeIsObject: function (x) {
if (x === void 0 || x === null || x === true || x === false) {
return false;
}
return typeof x === 'function' || typeof x === 'object';
},
ToObject: function (o, optMessage) {
return Object(ES.RequireObjectCoercible(o, optMessage));
},
IsCallable: isCallable,
IsConstructor: function (x) {
// We can't tell callables from constructors in ES5
return ES.IsCallable(x);
},
ToInt32: function (x) {
return ES.ToNumber(x) >> 0;
},
ToUint32: function (x) {
return ES.ToNumber(x) >>> 0;
},
ToNumber: function (value) {
if (_toString(value) === '[object Symbol]') {
throw new TypeError('Cannot convert a Symbol value to a number');
}
return +value;
},
ToInteger: function (value) {
var number = ES.ToNumber(value);
if (numberIsNaN(number)) { return 0; }
if (number === 0 || !numberIsFinite(number)) { return number; }
return (number > 0 ? 1 : -1) * _floor(_abs(number));
},
ToLength: function (value) {
var len = ES.ToInteger(value);
if (len <= 0) { return 0; } // includes converting -0 to +0
if (len > Number.MAX_SAFE_INTEGER) { return Number.MAX_SAFE_INTEGER; }
return len;
},
SameValue: function (a, b) {
if (a === b) {
// 0 === -0, but they are not identical.
if (a === 0) { return 1 / a === 1 / b; }
return true;
}
return numberIsNaN(a) && numberIsNaN(b);
},
SameValueZero: function (a, b) {
// same as SameValue except for SameValueZero(+0, -0) == true
return (a === b) || (numberIsNaN(a) && numberIsNaN(b));
},
IsIterable: function (o) {
return ES.TypeIsObject(o) && (typeof o[$iterator$] !== 'undefined' || isArguments(o));
},
GetIterator: function (o) {
if (isArguments(o)) {
// special case support for `arguments`
return new ArrayIterator(o, 'value');
}
var itFn = ES.GetMethod(o, $iterator$);
if (!ES.IsCallable(itFn)) {
// Better diagnostics if itFn is null or undefined
throw new TypeError('value is not an iterable');
}
var it = ES.Call(itFn, o);
if (!ES.TypeIsObject(it)) {
throw new TypeError('bad iterator');
}
return it;
},
GetMethod: function (o, p) {
var func = ES.ToObject(o)[p];
if (func === void 0 || func === null) {
return void 0;
}
if (!ES.IsCallable(func)) {
throw new TypeError('Method not callable: ' + p);
}
return func;
},
IteratorComplete: function (iterResult) {
return !!(iterResult.done);
},
IteratorClose: function (iterator, completionIsThrow) {
var returnMethod = ES.GetMethod(iterator, 'return');
if (returnMethod === void 0) {
return;
}
var innerResult, innerException;
try {
innerResult = ES.Call(returnMethod, iterator);
} catch (e) {
innerException = e;
}
if (completionIsThrow) {
return;
}
if (innerException) {
throw innerException;
}
if (!ES.TypeIsObject(innerResult)) {
throw new TypeError("Iterator's return method returned a non-object.");
}
},
IteratorNext: function (it) {
var result = arguments.length > 1 ? it.next(arguments[1]) : it.next();
if (!ES.TypeIsObject(result)) {
throw new TypeError('bad iterator');
}
return result;
},
IteratorStep: function (it) {
var result = ES.IteratorNext(it);
var done = ES.IteratorComplete(result);
return done ? false : result;
},
Construct: function (C, args, newTarget, isES6internal) {
var target = typeof newTarget === 'undefined' ? C : newTarget;
if (!isES6internal && Reflect.construct) {
// Try to use Reflect.construct if available
return Reflect.construct(C, args, target);
}
// OK, we have to fake it. This will only work if the
// C.[[ConstructorKind]] == "base" -- but that's the only
// kind we can make in ES5 code anyway.
// OrdinaryCreateFromConstructor(target, "%ObjectPrototype%")
var proto = target.prototype;
if (!ES.TypeIsObject(proto)) {
proto = Object.prototype;
}
var obj = create(proto);
// Call the constructor.
var result = ES.Call(C, obj, args);
return ES.TypeIsObject(result) ? result : obj;
},
SpeciesConstructor: function (O, defaultConstructor) {
var C = O.constructor;
if (C === void 0) {
return defaultConstructor;
}
if (!ES.TypeIsObject(C)) {
throw new TypeError('Bad constructor');
}
var S = C[symbolSpecies];
if (S === void 0 || S === null) {
return defaultConstructor;
}
if (!ES.IsConstructor(S)) {
throw new TypeError('Bad @@species');
}
return S;
},
CreateHTML: function (string, tag, attribute, value) {
var S = ES.ToString(string);
var p1 = '<' + tag;
if (attribute !== '') {
var V = ES.ToString(value);
var escapedV = V.replace(/"/g, '"');
p1 += ' ' + attribute + '="' + escapedV + '"';
}
var p2 = p1 + '>';
var p3 = p2 + S;
return p3 + '' + tag + '>';
},
IsRegExp: function IsRegExp(argument) {
if (!ES.TypeIsObject(argument)) {
return false;
}
var isRegExp = argument[Symbol.match];
if (typeof isRegExp !== 'undefined') {
return !!isRegExp;
}
return Type.regex(argument);
},
ToString: function ToString(string) {
return $String(string);
}
};
// Well-known Symbol shims
if (supportsDescriptors && hasSymbols) {
var defineWellKnownSymbol = function defineWellKnownSymbol(name) {
if (Type.symbol(Symbol[name])) {
return Symbol[name];
}
var sym = Symbol['for']('Symbol.' + name);
Object.defineProperty(Symbol, name, {
configurable: false,
enumerable: false,
writable: false,
value: sym
});
return sym;
};
if (!Type.symbol(Symbol.search)) {
var symbolSearch = defineWellKnownSymbol('search');
var originalSearch = String.prototype.search;
defineProperty(RegExp.prototype, symbolSearch, function search(string) {
return ES.Call(originalSearch, string, [this]);
});
var searchShim = function search(regexp) {
var O = ES.RequireObjectCoercible(this);
if (regexp !== null && typeof regexp !== 'undefined') {
var searcher = ES.GetMethod(regexp, symbolSearch);
if (typeof searcher !== 'undefined') {
return ES.Call(searcher, regexp, [O]);
}
}
return ES.Call(originalSearch, O, [ES.ToString(regexp)]);
};
overrideNative(String.prototype, 'search', searchShim);
}
if (!Type.symbol(Symbol.replace)) {
var symbolReplace = defineWellKnownSymbol('replace');
var originalReplace = String.prototype.replace;
defineProperty(RegExp.prototype, symbolReplace, function replace(string, replaceValue) {
return ES.Call(originalReplace, string, [this, replaceValue]);
});
var replaceShim = function replace(searchValue, replaceValue) {
var O = ES.RequireObjectCoercible(this);
if (searchValue !== null && typeof searchValue !== 'undefined') {
var replacer = ES.GetMethod(searchValue, symbolReplace);
if (typeof replacer !== 'undefined') {
return ES.Call(replacer, searchValue, [O, replaceValue]);
}
}
return ES.Call(originalReplace, O, [ES.ToString(searchValue), replaceValue]);
};
overrideNative(String.prototype, 'replace', replaceShim);
}
if (!Type.symbol(Symbol.split)) {
var symbolSplit = defineWellKnownSymbol('split');
var originalSplit = String.prototype.split;
defineProperty(RegExp.prototype, symbolSplit, function split(string, limit) {
return ES.Call(originalSplit, string, [this, limit]);
});
var splitShim = function split(separator, limit) {
var O = ES.RequireObjectCoercible(this);
if (separator !== null && typeof separator !== 'undefined') {
var splitter = ES.GetMethod(separator, symbolSplit);
if (typeof splitter !== 'undefined') {
return ES.Call(splitter, separator, [O, limit]);
}
}
return ES.Call(originalSplit, O, [ES.ToString(separator), limit]);
};
overrideNative(String.prototype, 'split', splitShim);
}
var symbolMatchExists = Type.symbol(Symbol.match);
var stringMatchIgnoresSymbolMatch = symbolMatchExists && (function () {
// Firefox 41, through Nightly 45 has Symbol.match, but String#match ignores it.
// Firefox 40 and below have Symbol.match but String#match works fine.
var o = {};
o[Symbol.match] = function () { return 42; };
return 'a'.match(o) !== 42;
}());
if (!symbolMatchExists || stringMatchIgnoresSymbolMatch) {
var symbolMatch = defineWellKnownSymbol('match');
var originalMatch = String.prototype.match;
defineProperty(RegExp.prototype, symbolMatch, function match(string) {
return ES.Call(originalMatch, string, [this]);
});
var matchShim = function match(regexp) {
var O = ES.RequireObjectCoercible(this);
if (regexp !== null && typeof regexp !== 'undefined') {
var matcher = ES.GetMethod(regexp, symbolMatch);
if (typeof matcher !== 'undefined') {
return ES.Call(matcher, regexp, [O]);
}
}
return ES.Call(originalMatch, O, [ES.ToString(regexp)]);
};
overrideNative(String.prototype, 'match', matchShim);
}
}
var wrapConstructor = function wrapConstructor(original, replacement, keysToSkip) {
Value.preserveToString(replacement, original);
if (Object.setPrototypeOf) {
// sets up proper prototype chain where possible
Object.setPrototypeOf(original, replacement);
}
if (supportsDescriptors) {
_forEach(Object.getOwnPropertyNames(original), function (key) {
if (key in noop || keysToSkip[key]) { return; }
Value.proxy(original, key, replacement);
});
} else {
_forEach(Object.keys(original), function (key) {
if (key in noop || keysToSkip[key]) { return; }
replacement[key] = original[key];
});
}
replacement.prototype = original.prototype;
Value.redefine(original.prototype, 'constructor', replacement);
};
var defaultSpeciesGetter = function () { return this; };
var addDefaultSpecies = function (C) {
if (supportsDescriptors && !_hasOwnProperty(C, symbolSpecies)) {
Value.getter(C, symbolSpecies, defaultSpeciesGetter);
}
};
var addIterator = function (prototype, impl) {
var implementation = impl || function iterator() { return this; };
defineProperty(prototype, $iterator$, implementation);
if (!prototype[$iterator$] && Type.symbol($iterator$)) {
// implementations are buggy when $iterator$ is a Symbol
prototype[$iterator$] = implementation;
}
};
var createDataProperty = function createDataProperty(object, name, value) {
if (supportsDescriptors) {
Object.defineProperty(object, name, {
configurable: true,
enumerable: true,
writable: true,
value: value
});
} else {
object[name] = value;
}
};
var createDataPropertyOrThrow = function createDataPropertyOrThrow(object, name, value) {
createDataProperty(object, name, value);
if (!ES.SameValue(object[name], value)) {
throw new TypeError('property is nonconfigurable');
}
};
var emulateES6construct = function (o, defaultNewTarget, defaultProto, slots) {
// This is an es5 approximation to es6 construct semantics. in es6,
// 'new Foo' invokes Foo.[[Construct]] which (for almost all objects)
// just sets the internal variable NewTarget (in es6 syntax `new.target`)
// to Foo and then returns Foo().
// Many ES6 object then have constructors of the form:
// 1. If NewTarget is undefined, throw a TypeError exception
// 2. Let xxx by OrdinaryCreateFromConstructor(NewTarget, yyy, zzz)
// So we're going to emulate those first two steps.
if (!ES.TypeIsObject(o)) {
throw new TypeError('Constructor requires `new`: ' + defaultNewTarget.name);
}
var proto = defaultNewTarget.prototype;
if (!ES.TypeIsObject(proto)) {
proto = defaultProto;
}
var obj = create(proto);
for (var name in slots) {
if (_hasOwnProperty(slots, name)) {
var value = slots[name];
defineProperty(obj, name, value, true);
}
}
return obj;
};
// Firefox 31 reports this function's length as 0
// https://bugzilla.mozilla.org/show_bug.cgi?id=1062484
if (String.fromCodePoint && String.fromCodePoint.length !== 1) {
var originalFromCodePoint = String.fromCodePoint;
overrideNative(String, 'fromCodePoint', function fromCodePoint(codePoints) { return ES.Call(originalFromCodePoint, this, arguments); });
}
var StringShims = {
fromCodePoint: function fromCodePoint(codePoints) {
var result = [];
var next;
for (var i = 0, length = arguments.length; i < length; i++) {
next = Number(arguments[i]);
if (!ES.SameValue(next, ES.ToInteger(next)) || next < 0 || next > 0x10FFFF) {
throw new RangeError('Invalid code point ' + next);
}
if (next < 0x10000) {
_push(result, String.fromCharCode(next));
} else {
next -= 0x10000;
_push(result, String.fromCharCode((next >> 10) + 0xD800));
_push(result, String.fromCharCode((next % 0x400) + 0xDC00));
}
}
return result.join('');
},
raw: function raw(callSite) {
var cooked = ES.ToObject(callSite, 'bad callSite');
var rawString = ES.ToObject(cooked.raw, 'bad raw value');
var len = rawString.length;
var literalsegments = ES.ToLength(len);
if (literalsegments <= 0) {
return '';
}
var stringElements = [];
var nextIndex = 0;
var nextKey, next, nextSeg, nextSub;
while (nextIndex < literalsegments) {
nextKey = ES.ToString(nextIndex);
nextSeg = ES.ToString(rawString[nextKey]);
_push(stringElements, nextSeg);
if (nextIndex + 1 >= literalsegments) {
break;
}
next = nextIndex + 1 < arguments.length ? arguments[nextIndex + 1] : '';
nextSub = ES.ToString(next);
_push(stringElements, nextSub);
nextIndex += 1;
}
return stringElements.join('');
}
};
if (String.raw && String.raw({ raw: { 0: 'x', 1: 'y', length: 2 } }) !== 'xy') {
// IE 11 TP has a broken String.raw implementation
overrideNative(String, 'raw', StringShims.raw);
}
defineProperties(String, StringShims);
// Fast repeat, uses the `Exponentiation by squaring` algorithm.
// Perf: http://jsperf.com/string-repeat2/2
var stringRepeat = function repeat(s, times) {
if (times < 1) { return ''; }
if (times % 2) { return repeat(s, times - 1) + s; }
var half = repeat(s, times / 2);
return half + half;
};
var stringMaxLength = Infinity;
var StringPrototypeShims = {
repeat: function repeat(times) {
var thisStr = ES.ToString(ES.RequireObjectCoercible(this));
var numTimes = ES.ToInteger(times);
if (numTimes < 0 || numTimes >= stringMaxLength) {
throw new RangeError('repeat count must be less than infinity and not overflow maximum string size');
}
return stringRepeat(thisStr, numTimes);
},
startsWith: function startsWith(searchString) {
var S = ES.ToString(ES.RequireObjectCoercible(this));
if (ES.IsRegExp(searchString)) {
throw new TypeError('Cannot call method "startsWith" with a regex');
}
var searchStr = ES.ToString(searchString);
var position;
if (arguments.length > 1) {
position = arguments[1];
}
var start = _max(ES.ToInteger(position), 0);
return _strSlice(S, start, start + searchStr.length) === searchStr;
},
endsWith: function endsWith(searchString) {
var S = ES.ToString(ES.RequireObjectCoercible(this));
if (ES.IsRegExp(searchString)) {
throw new TypeError('Cannot call method "endsWith" with a regex');
}
var searchStr = ES.ToString(searchString);
var len = S.length;
var endPosition;
if (arguments.length > 1) {
endPosition = arguments[1];
}
var pos = typeof endPosition === 'undefined' ? len : ES.ToInteger(endPosition);
var end = _min(_max(pos, 0), len);
return _strSlice(S, end - searchStr.length, end) === searchStr;
},
includes: function includes(searchString) {
if (ES.IsRegExp(searchString)) {
throw new TypeError('"includes" does not accept a RegExp');
}
var searchStr = ES.ToString(searchString);
var position;
if (arguments.length > 1) {
position = arguments[1];
}
// Somehow this trick makes method 100% compat with the spec.
return _indexOf(this, searchStr, position) !== -1;
},
codePointAt: function codePointAt(pos) {
var thisStr = ES.ToString(ES.RequireObjectCoercible(this));
var position = ES.ToInteger(pos);
var length = thisStr.length;
if (position >= 0 && position < length) {
var first = thisStr.charCodeAt(position);
var isEnd = (position + 1 === length);
if (first < 0xD800 || first > 0xDBFF || isEnd) { return first; }
var second = thisStr.charCodeAt(position + 1);
if (second < 0xDC00 || second > 0xDFFF) { return first; }
return ((first - 0xD800) * 1024) + (second - 0xDC00) + 0x10000;
}
}
};
if (String.prototype.includes && 'a'.includes('a', Infinity) !== false) {
overrideNative(String.prototype, 'includes', StringPrototypeShims.includes);
}
if (String.prototype.startsWith && String.prototype.endsWith) {
var startsWithRejectsRegex = throwsError(function () {
/* throws if spec-compliant */
'/a/'.startsWith(/a/);
});
var startsWithHandlesInfinity = valueOrFalseIfThrows(function () {
return 'abc'.startsWith('a', Infinity) === false;
});
if (!startsWithRejectsRegex || !startsWithHandlesInfinity) {
// Firefox (< 37?) and IE 11 TP have a noncompliant startsWith implementation
overrideNative(String.prototype, 'startsWith', StringPrototypeShims.startsWith);
overrideNative(String.prototype, 'endsWith', StringPrototypeShims.endsWith);
}
}
if (hasSymbols) {
var startsWithSupportsSymbolMatch = valueOrFalseIfThrows(function () {
var re = /a/;
re[Symbol.match] = false;
return '/a/'.startsWith(re);
});
if (!startsWithSupportsSymbolMatch) {
overrideNative(String.prototype, 'startsWith', StringPrototypeShims.startsWith);
}
var endsWithSupportsSymbolMatch = valueOrFalseIfThrows(function () {
var re = /a/;
re[Symbol.match] = false;
return '/a/'.endsWith(re);
});
if (!endsWithSupportsSymbolMatch) {
overrideNative(String.prototype, 'endsWith', StringPrototypeShims.endsWith);
}
var includesSupportsSymbolMatch = valueOrFalseIfThrows(function () {
var re = /a/;
re[Symbol.match] = false;
return '/a/'.includes(re);
});
if (!includesSupportsSymbolMatch) {
overrideNative(String.prototype, 'includes', StringPrototypeShims.includes);
}
}
defineProperties(String.prototype, StringPrototypeShims);
// whitespace from: http://es5.github.io/#x15.5.4.20
// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
var ws = [
'\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
'\u2029\uFEFF'
].join('');
var trimRegexp = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
var trimShim = function trim() {
return ES.ToString(ES.RequireObjectCoercible(this)).replace(trimRegexp, '');
};
var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
var nonWSregex = new RegExp('[' + nonWS + ']', 'g');
var isBadHexRegex = /^[\-+]0x[0-9a-f]+$/i;
var hasStringTrimBug = nonWS.trim().length !== nonWS.length;
defineProperty(String.prototype, 'trim', trimShim, hasStringTrimBug);
// see https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator
var StringIterator = function (s) {
ES.RequireObjectCoercible(s);
this._s = ES.ToString(s);
this._i = 0;
};
StringIterator.prototype.next = function () {
var s = this._s, i = this._i;
if (typeof s === 'undefined' || i >= s.length) {
this._s = void 0;
return { value: void 0, done: true };
}
var first = s.charCodeAt(i), second, len;
if (first < 0xD800 || first > 0xDBFF || (i + 1) === s.length) {
len = 1;
} else {
second = s.charCodeAt(i + 1);
len = (second < 0xDC00 || second > 0xDFFF) ? 1 : 2;
}
this._i = i + len;
return { value: s.substr(i, len), done: false };
};
addIterator(StringIterator.prototype);
addIterator(String.prototype, function () {
return new StringIterator(this);
});
var ArrayShims = {
from: function from(items) {
var C = this;
var mapFn;
if (arguments.length > 1) {
mapFn = arguments[1];
}
var mapping, T;
if (typeof mapFn === 'undefined') {
mapping = false;
} else {
if (!ES.IsCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
mapping = true;
}
// Note that that Arrays will use ArrayIterator:
// https://bugs.ecmascript.org/show_bug.cgi?id=2416
var usingIterator = typeof (isArguments(items) || ES.GetMethod(items, $iterator$)) !== 'undefined';
var length, result, i;
if (usingIterator) {
result = ES.IsConstructor(C) ? Object(new C()) : [];
var iterator = ES.GetIterator(items);
var next, nextValue;
i = 0;
while (true) {
next = ES.IteratorStep(iterator);
if (next === false) {
break;
}
nextValue = next.value;
try {
if (mapping) {
nextValue = typeof T === 'undefined' ? mapFn(nextValue, i) : _call(mapFn, T, nextValue, i);
}
result[i] = nextValue;
} catch (e) {
ES.IteratorClose(iterator, true);
throw e;
}
i += 1;
}
length = i;
} else {
var arrayLike = ES.ToObject(items);
length = ES.ToLength(arrayLike.length);
result = ES.IsConstructor(C) ? Object(new C(length)) : new Array(length);
var value;
for (i = 0; i < length; ++i) {
value = arrayLike[i];
if (mapping) {
value = typeof T === 'undefined' ? mapFn(value, i) : _call(mapFn, T, value, i);
}
result[i] = value;
}
}
result.length = length;
return result;
},
of: function of() {
var len = arguments.length;
var C = this;
var A = isArray(C) || !ES.IsCallable(C) ? new Array(len) : ES.Construct(C, [len]);
for (var k = 0; k < len; ++k) {
createDataPropertyOrThrow(A, k, arguments[k]);
}
A.length = len;
return A;
}
};
defineProperties(Array, ArrayShims);
addDefaultSpecies(Array);
// Given an argument x, it will return an IteratorResult object,
// with value set to x and done to false.
// Given no arguments, it will return an iterator completion object.
var iteratorResult = function (x) {
return { value: x, done: arguments.length === 0 };
};
// Our ArrayIterator is private; see
// https://github.com/paulmillr/es6-shim/issues/252
ArrayIterator = function (array, kind) {
this.i = 0;
this.array = array;
this.kind = kind;
};
defineProperties(ArrayIterator.prototype, {
next: function () {
var i = this.i, array = this.array;
if (!(this instanceof ArrayIterator)) {
throw new TypeError('Not an ArrayIterator');
}
if (typeof array !== 'undefined') {
var len = ES.ToLength(array.length);
for (; i < len; i++) {
var kind = this.kind;
var retval;
if (kind === 'key') {
retval = i;
} else if (kind === 'value') {
retval = array[i];
} else if (kind === 'entry') {
retval = [i, array[i]];
}
this.i = i + 1;
return { value: retval, done: false };
}
}
this.array = void 0;
return { value: void 0, done: true };
}
});
addIterator(ArrayIterator.prototype);
var orderKeys = function orderKeys(a, b) {
var aNumeric = String(ES.ToInteger(a)) === a;
var bNumeric = String(ES.ToInteger(b)) === b;
if (aNumeric && bNumeric) {
return b - a;
} else if (aNumeric && !bNumeric) {
return -1;
} else if (!aNumeric && bNumeric) {
return 1;
} else {
return a.localeCompare(b);
}
};
var getAllKeys = function getAllKeys(object) {
var ownKeys = [];
var keys = [];
for (var key in object) {
_push(_hasOwnProperty(object, key) ? ownKeys : keys, key);
}
_sort(ownKeys, orderKeys);
_sort(keys, orderKeys);
return _concat(ownKeys, keys);
};
// note: this is positioned here because it depends on ArrayIterator
var arrayOfSupportsSubclassing = Array.of === ArrayShims.of || (function () {
// Detects a bug in Webkit nightly r181886
var Foo = function Foo(len) { this.length = len; };
Foo.prototype = [];
var fooArr = Array.of.apply(Foo, [1, 2]);
return fooArr instanceof Foo && fooArr.length === 2;
}());
if (!arrayOfSupportsSubclassing) {
overrideNative(Array, 'of', ArrayShims.of);
}
var ArrayPrototypeShims = {
copyWithin: function copyWithin(target, start) {
var o = ES.ToObject(this);
var len = ES.ToLength(o.length);
var relativeTarget = ES.ToInteger(target);
var relativeStart = ES.ToInteger(start);
var to = relativeTarget < 0 ? _max(len + relativeTarget, 0) : _min(relativeTarget, len);
var from = relativeStart < 0 ? _max(len + relativeStart, 0) : _min(relativeStart, len);
var end;
if (arguments.length > 2) {
end = arguments[2];
}
var relativeEnd = typeof end === 'undefined' ? len : ES.ToInteger(end);
var finalItem = relativeEnd < 0 ? _max(len + relativeEnd, 0) : _min(relativeEnd, len);
var count = _min(finalItem - from, len - to);
var direction = 1;
if (from < to && to < (from + count)) {
direction = -1;
from += count - 1;
to += count - 1;
}
while (count > 0) {
if (from in o) {
o[to] = o[from];
} else {
delete o[to];
}
from += direction;
to += direction;
count -= 1;
}
return o;
},
fill: function fill(value) {
var start;
if (arguments.length > 1) {
start = arguments[1];
}
var end;
if (arguments.length > 2) {
end = arguments[2];
}
var O = ES.ToObject(this);
var len = ES.ToLength(O.length);
start = ES.ToInteger(typeof start === 'undefined' ? 0 : start);
end = ES.ToInteger(typeof end === 'undefined' ? len : end);
var relativeStart = start < 0 ? _max(len + start, 0) : _min(start, len);
var relativeEnd = end < 0 ? len + end : end;
for (var i = relativeStart; i < len && i < relativeEnd; ++i) {
O[i] = value;
}
return O;
},
find: function find(predicate) {
var list = ES.ToObject(this);
var length = ES.ToLength(list.length);
if (!ES.IsCallable(predicate)) {
throw new TypeError('Array#find: predicate must be a function');
}
var thisArg = arguments.length > 1 ? arguments[1] : null;
for (var i = 0, value; i < length; i++) {
value = list[i];
if (thisArg) {
if (_call(predicate, thisArg, value, i, list)) { return value; }
} else if (predicate(value, i, list)) {
return value;
}
}
},
findIndex: function findIndex(predicate) {
var list = ES.ToObject(this);
var length = ES.ToLength(list.length);
if (!ES.IsCallable(predicate)) {
throw new TypeError('Array#findIndex: predicate must be a function');
}
var thisArg = arguments.length > 1 ? arguments[1] : null;
for (var i = 0; i < length; i++) {
if (thisArg) {
if (_call(predicate, thisArg, list[i], i, list)) { return i; }
} else if (predicate(list[i], i, list)) {
return i;
}
}
return -1;
},
keys: function keys() {
return new ArrayIterator(this, 'key');
},
values: function values() {
return new ArrayIterator(this, 'value');
},
entries: function entries() {
return new ArrayIterator(this, 'entry');
}
};
// Safari 7.1 defines Array#keys and Array#entries natively,
// but the resulting ArrayIterator objects don't have a "next" method.
if (Array.prototype.keys && !ES.IsCallable([1].keys().next)) {
delete Array.prototype.keys;
}
if (Array.prototype.entries && !ES.IsCallable([1].entries().next)) {
delete Array.prototype.entries;
}
// Chrome 38 defines Array#keys and Array#entries, and Array#@@iterator, but not Array#values
if (Array.prototype.keys && Array.prototype.entries && !Array.prototype.values && Array.prototype[$iterator$]) {
defineProperties(Array.prototype, {
values: Array.prototype[$iterator$]
});
if (Type.symbol(Symbol.unscopables)) {
Array.prototype[Symbol.unscopables].values = true;
}
}
// Chrome 40 defines Array#values with the incorrect name, although Array#{keys,entries} have the correct name
if (functionsHaveNames && Array.prototype.values && Array.prototype.values.name !== 'values') {
var originalArrayPrototypeValues = Array.prototype.values;
overrideNative(Array.prototype, 'values', function values() { return ES.Call(originalArrayPrototypeValues, this, arguments); });
defineProperty(Array.prototype, $iterator$, Array.prototype.values, true);
}
defineProperties(Array.prototype, ArrayPrototypeShims);
if (1 / [true].indexOf(true, -0) < 0) {
// indexOf when given a position arg of -0 should return +0.
// https://github.com/tc39/ecma262/pull/316
defineProperty(Array.prototype, 'indexOf', function indexOf(searchElement) {
var value = _arrayIndexOfApply(this, arguments);
if (value === 0 && (1 / value) < 0) {
return 0;
}
return value;
}, true);
}
addIterator(Array.prototype, function () { return this.values(); });
// Chrome defines keys/values/entries on Array, but doesn't give us
// any way to identify its iterator. So add our own shimmed field.
if (Object.getPrototypeOf) {
addIterator(Object.getPrototypeOf([].values()));
}
// note: this is positioned here because it relies on Array#entries
var arrayFromSwallowsNegativeLengths = (function () {
// Detects a Firefox bug in v32
// https://bugzilla.mozilla.org/show_bug.cgi?id=1063993
return valueOrFalseIfThrows(function () { return Array.from({ length: -1 }).length === 0; });
}());
var arrayFromHandlesIterables = (function () {
// Detects a bug in Webkit nightly r181886
var arr = Array.from([0].entries());
return arr.length === 1 && isArray(arr[0]) && arr[0][0] === 0 && arr[0][1] === 0;
}());
if (!arrayFromSwallowsNegativeLengths || !arrayFromHandlesIterables) {
overrideNative(Array, 'from', ArrayShims.from);
}
var arrayFromHandlesUndefinedMapFunction = (function () {
// Microsoft Edge v0.11 throws if the mapFn argument is *provided* but undefined,
// but the spec doesn't care if it's provided or not - undefined doesn't throw.
return valueOrFalseIfThrows(function () { return Array.from([0], void 0); });
}());
if (!arrayFromHandlesUndefinedMapFunction) {
var origArrayFrom = Array.from;
overrideNative(Array, 'from', function from(items) {
if (arguments.length > 1 && typeof arguments[1] !== 'undefined') {
return ES.Call(origArrayFrom, this, arguments);
} else {
return _call(origArrayFrom, this, items);
}
});
}
var int32sAsOne = -(Math.pow(2, 32) - 1);
var toLengthsCorrectly = function (method, reversed) {
var obj = { length: int32sAsOne };
obj[reversed ? ((obj.length >>> 0) - 1) : 0] = true;
return valueOrFalseIfThrows(function () {
_call(method, obj, function () {
// note: in nonconforming browsers, this will be called
// -1 >>> 0 times, which is 4294967295, so the throw matters.
throw new RangeError('should not reach here');
}, []);
return true;
});
};
if (!toLengthsCorrectly(Array.prototype.forEach)) {
var originalForEach = Array.prototype.forEach;
overrideNative(Array.prototype, 'forEach', function forEach(callbackFn) {
return ES.Call(originalForEach, this.length >= 0 ? this : [], arguments);
}, true);
}
if (!toLengthsCorrectly(Array.prototype.map)) {
var originalMap = Array.prototype.map;
overrideNative(Array.prototype, 'map', function map(callbackFn) {
return ES.Call(originalMap, this.length >= 0 ? this : [], arguments);
}, true);
}
if (!toLengthsCorrectly(Array.prototype.filter)) {
var originalFilter = Array.prototype.filter;
overrideNative(Array.prototype, 'filter', function filter(callbackFn) {
return ES.Call(originalFilter, this.length >= 0 ? this : [], arguments);
}, true);
}
if (!toLengthsCorrectly(Array.prototype.some)) {
var originalSome = Array.prototype.some;
overrideNative(Array.prototype, 'some', function some(callbackFn) {
return ES.Call(originalSome, this.length >= 0 ? this : [], arguments);
}, true);
}
if (!toLengthsCorrectly(Array.prototype.every)) {
var originalEvery = Array.prototype.every;
overrideNative(Array.prototype, 'every', function every(callbackFn) {
return ES.Call(originalEvery, this.length >= 0 ? this : [], arguments);
}, true);
}
if (!toLengthsCorrectly(Array.prototype.reduce)) {
var originalReduce = Array.prototype.reduce;
overrideNative(Array.prototype, 'reduce', function reduce(callbackFn) {
return ES.Call(originalReduce, this.length >= 0 ? this : [], arguments);
}, true);
}
if (!toLengthsCorrectly(Array.prototype.reduceRight, true)) {
var originalReduceRight = Array.prototype.reduceRight;
overrideNative(Array.prototype, 'reduceRight', function reduceRight(callbackFn) {
return ES.Call(originalReduceRight, this.length >= 0 ? this : [], arguments);
}, true);
}
var lacksOctalSupport = Number('0o10') !== 8;
var lacksBinarySupport = Number('0b10') !== 2;
var trimsNonWhitespace = _some(nonWS, function (c) {
return Number(c + 0 + c) === 0;
});
if (lacksOctalSupport || lacksBinarySupport || trimsNonWhitespace) {
var OrigNumber = Number;
var binaryRegex = /^0b[01]+$/i;
var octalRegex = /^0o[0-7]+$/i;
// Note that in IE 8, RegExp.prototype.test doesn't seem to exist: ie, "test" is an own property of regexes. wtf.
var isBinary = binaryRegex.test.bind(binaryRegex);
var isOctal = octalRegex.test.bind(octalRegex);
var toPrimitive = function (O) { // need to replace this with `es-to-primitive/es6`
var result;
if (typeof O.valueOf === 'function') {
result = O.valueOf();
if (Type.primitive(result)) {
return result;
}
}
if (typeof O.toString === 'function') {
result = O.toString();
if (Type.primitive(result)) {
return result;
}
}
throw new TypeError('No default value');
};
var hasNonWS = nonWSregex.test.bind(nonWSregex);
var isBadHex = isBadHexRegex.test.bind(isBadHexRegex);
var NumberShim = (function () {
// this is wrapped in an IIFE because of IE 6-8's wacky scoping issues with named function expressions.
var NumberShim = function Number(value) {
var primValue;
if (arguments.length > 0) {
primValue = Type.primitive(value) ? value : toPrimitive(value, 'number');
} else {
primValue = 0;
}
if (typeof primValue === 'string') {
primValue = ES.Call(trimShim, primValue);
if (isBinary(primValue)) {
primValue = parseInt(_strSlice(primValue, 2), 2);
} else if (isOctal(primValue)) {
primValue = parseInt(_strSlice(primValue, 2), 8);
} else if (hasNonWS(primValue) || isBadHex(primValue)) {
primValue = NaN;
}
}
var receiver = this;
var valueOfSucceeds = valueOrFalseIfThrows(function () {
OrigNumber.prototype.valueOf.call(receiver);
return true;
});
if (receiver instanceof NumberShim && !valueOfSucceeds) {
return new OrigNumber(primValue);
}
/* jshint newcap: false */
return OrigNumber(primValue);
/* jshint newcap: true */
};
return NumberShim;
}());
wrapConstructor(OrigNumber, NumberShim, {});
// this is necessary for ES3 browsers, where these properties are non-enumerable.
defineProperties(NumberShim, {
NaN: OrigNumber.NaN,
MAX_VALUE: OrigNumber.MAX_VALUE,
MIN_VALUE: OrigNumber.MIN_VALUE,
NEGATIVE_INFINITY: OrigNumber.NEGATIVE_INFINITY,
POSITIVE_INFINITY: OrigNumber.POSITIVE_INFINITY
});
/* globals Number: true */
/* eslint-disable no-undef */
/* jshint -W020 */
Number = NumberShim;
Value.redefine(globals, 'Number', NumberShim);
/* jshint +W020 */
/* eslint-enable no-undef */
/* globals Number: false */
}
var maxSafeInteger = Math.pow(2, 53) - 1;
defineProperties(Number, {
MAX_SAFE_INTEGER: maxSafeInteger,
MIN_SAFE_INTEGER: -maxSafeInteger,
EPSILON: 2.220446049250313e-16,
parseInt: globals.parseInt,
parseFloat: globals.parseFloat,
isFinite: numberIsFinite,
isInteger: function isInteger(value) {
return numberIsFinite(value) && ES.ToInteger(value) === value;
},
isSafeInteger: function isSafeInteger(value) {
return Number.isInteger(value) && _abs(value) <= Number.MAX_SAFE_INTEGER;
},
isNaN: numberIsNaN
});
// Firefox 37 has a conforming Number.parseInt, but it's not === to the global parseInt (fixed in v40)
defineProperty(Number, 'parseInt', globals.parseInt, Number.parseInt !== globals.parseInt);
// Work around bugs in Array#find and Array#findIndex -- early
// implementations skipped holes in sparse arrays. (Note that the
// implementations of find/findIndex indirectly use shimmed
// methods of Number, so this test has to happen down here.)
/*jshint elision: true */
/* eslint-disable no-sparse-arrays */
if (![, 1].find(function (item, idx) { return idx === 0; })) {
overrideNative(Array.prototype, 'find', ArrayPrototypeShims.find);
}
if ([, 1].findIndex(function (item, idx) { return idx === 0; }) !== 0) {
overrideNative(Array.prototype, 'findIndex', ArrayPrototypeShims.findIndex);
}
/* eslint-enable no-sparse-arrays */
/*jshint elision: false */
var isEnumerableOn = Function.bind.call(Function.bind, Object.prototype.propertyIsEnumerable);
var ensureEnumerable = function ensureEnumerable(obj, prop) {
if (supportsDescriptors && isEnumerableOn(obj, prop)) {
Object.defineProperty(obj, prop, { enumerable: false });
}
};
var sliceArgs = function sliceArgs() {
// per https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
// and https://gist.github.com/WebReflection/4327762cb87a8c634a29
var initial = Number(this);
var len = arguments.length;
var desiredArgCount = len - initial;
var args = new Array(desiredArgCount < 0 ? 0 : desiredArgCount);
for (var i = initial; i < len; ++i) {
args[i - initial] = arguments[i];
}
return args;
};
var assignTo = function assignTo(source) {
return function assignToSource(target, key) {
target[key] = source[key];
return target;
};
};
var assignReducer = function (target, source) {
var sourceKeys = keys(Object(source));
var symbols;
if (ES.IsCallable(Object.getOwnPropertySymbols)) {
symbols = _filter(Object.getOwnPropertySymbols(Object(source)), isEnumerableOn(source));
}
return _reduce(_concat(sourceKeys, symbols || []), assignTo(source), target);
};
var ObjectShims = {
// 19.1.3.1
assign: function (target, source) {
var to = ES.ToObject(target, 'Cannot convert undefined or null to object');
return _reduce(ES.Call(sliceArgs, 1, arguments), assignReducer, to);
},
// Added in WebKit in https://bugs.webkit.org/show_bug.cgi?id=143865
is: function is(a, b) {
return ES.SameValue(a, b);
}
};
var assignHasPendingExceptions = Object.assign && Object.preventExtensions && (function () {
// Firefox 37 still has "pending exception" logic in its Object.assign implementation,
// which is 72% slower than our shim, and Firefox 40's native implementation.
var thrower = Object.preventExtensions({ 1: 2 });
try {
Object.assign(thrower, 'xy');
} catch (e) {
return thrower[1] === 'y';
}
}());
if (assignHasPendingExceptions) {
overrideNative(Object, 'assign', ObjectShims.assign);
}
defineProperties(Object, ObjectShims);
if (supportsDescriptors) {
var ES5ObjectShims = {
// 19.1.3.9
// shim from https://gist.github.com/WebReflection/5593554
setPrototypeOf: (function (Object, magic) {
var set;
var checkArgs = function (O, proto) {
if (!ES.TypeIsObject(O)) {
throw new TypeError('cannot set prototype on a non-object');
}
if (!(proto === null || ES.TypeIsObject(proto))) {
throw new TypeError('can only set prototype to an object or null' + proto);
}
};
var setPrototypeOf = function (O, proto) {
checkArgs(O, proto);
_call(set, O, proto);
return O;
};
try {
// this works already in Firefox and Safari
set = Object.getOwnPropertyDescriptor(Object.prototype, magic).set;
_call(set, {}, null);
} catch (e) {
if (Object.prototype !== {}[magic]) {
// IE < 11 cannot be shimmed
return;
}
// probably Chrome or some old Mobile stock browser
set = function (proto) {
this[magic] = proto;
};
// please note that this will **not** work
// in those browsers that do not inherit
// __proto__ by mistake from Object.prototype
// in these cases we should probably throw an error
// or at least be informed about the issue
setPrototypeOf.polyfill = setPrototypeOf(
setPrototypeOf({}, null),
Object.prototype
) instanceof Object;
// setPrototypeOf.polyfill === true means it works as meant
// setPrototypeOf.polyfill === false means it's not 100% reliable
// setPrototypeOf.polyfill === undefined
// or
// setPrototypeOf.polyfill == null means it's not a polyfill
// which means it works as expected
// we can even delete Object.prototype.__proto__;
}
return setPrototypeOf;
}(Object, '__proto__'))
};
defineProperties(Object, ES5ObjectShims);
}
// Workaround bug in Opera 12 where setPrototypeOf(x, null) doesn't work,
// but Object.create(null) does.
if (Object.setPrototypeOf && Object.getPrototypeOf &&
Object.getPrototypeOf(Object.setPrototypeOf({}, null)) !== null &&
Object.getPrototypeOf(Object.create(null)) === null) {
(function () {
var FAKENULL = Object.create(null);
var gpo = Object.getPrototypeOf, spo = Object.setPrototypeOf;
Object.getPrototypeOf = function (o) {
var result = gpo(o);
return result === FAKENULL ? null : result;
};
Object.setPrototypeOf = function (o, p) {
var proto = p === null ? FAKENULL : p;
return spo(o, proto);
};
Object.setPrototypeOf.polyfill = false;
}());
}
var objectKeysAcceptsPrimitives = !throwsError(function () { Object.keys('foo'); });
if (!objectKeysAcceptsPrimitives) {
var originalObjectKeys = Object.keys;
overrideNative(Object, 'keys', function keys(value) {
return originalObjectKeys(ES.ToObject(value));
});
keys = Object.keys;
}
var objectKeysRejectsRegex = throwsError(function () { Object.keys(/a/g); });
if (objectKeysRejectsRegex) {
var regexRejectingObjectKeys = Object.keys;
overrideNative(Object, 'keys', function keys(value) {
if (Type.regex(value)) {
var regexKeys = [];
for (var k in value) {
if (_hasOwnProperty(value, k)) {
_push(regexKeys, k);
}
}
return regexKeys;
}
return regexRejectingObjectKeys(value);
});
keys = Object.keys;
}
if (Object.getOwnPropertyNames) {
var objectGOPNAcceptsPrimitives = !throwsError(function () { Object.getOwnPropertyNames('foo'); });
if (!objectGOPNAcceptsPrimitives) {
var cachedWindowNames = typeof window === 'object' ? Object.getOwnPropertyNames(window) : [];
var originalObjectGetOwnPropertyNames = Object.getOwnPropertyNames;
overrideNative(Object, 'getOwnPropertyNames', function getOwnPropertyNames(value) {
var val = ES.ToObject(value);
if (_toString(val) === '[object Window]') {
try {
return originalObjectGetOwnPropertyNames(val);
} catch (e) {
// IE bug where layout engine calls userland gOPN for cross-domain `window` objects
return _concat([], cachedWindowNames);
}
}
return originalObjectGetOwnPropertyNames(val);
});
}
}
if (Object.getOwnPropertyDescriptor) {
var objectGOPDAcceptsPrimitives = !throwsError(function () { Object.getOwnPropertyDescriptor('foo', 'bar'); });
if (!objectGOPDAcceptsPrimitives) {
var originalObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
overrideNative(Object, 'getOwnPropertyDescriptor', function getOwnPropertyDescriptor(value, property) {
return originalObjectGetOwnPropertyDescriptor(ES.ToObject(value), property);
});
}
}
if (Object.seal) {
var objectSealAcceptsPrimitives = !throwsError(function () { Object.seal('foo'); });
if (!objectSealAcceptsPrimitives) {
var originalObjectSeal = Object.seal;
overrideNative(Object, 'seal', function seal(value) {
if (!Type.object(value)) { return value; }
return originalObjectSeal(value);
});
}
}
if (Object.isSealed) {
var objectIsSealedAcceptsPrimitives = !throwsError(function () { Object.isSealed('foo'); });
if (!objectIsSealedAcceptsPrimitives) {
var originalObjectIsSealed = Object.isSealed;
overrideNative(Object, 'isSealed', function isSealed(value) {
if (!Type.object(value)) { return true; }
return originalObjectIsSealed(value);
});
}
}
if (Object.freeze) {
var objectFreezeAcceptsPrimitives = !throwsError(function () { Object.freeze('foo'); });
if (!objectFreezeAcceptsPrimitives) {
var originalObjectFreeze = Object.freeze;
overrideNative(Object, 'freeze', function freeze(value) {
if (!Type.object(value)) { return value; }
return originalObjectFreeze(value);
});
}
}
if (Object.isFrozen) {
var objectIsFrozenAcceptsPrimitives = !throwsError(function () { Object.isFrozen('foo'); });
if (!objectIsFrozenAcceptsPrimitives) {
var originalObjectIsFrozen = Object.isFrozen;
overrideNative(Object, 'isFrozen', function isFrozen(value) {
if (!Type.object(value)) { return true; }
return originalObjectIsFrozen(value);
});
}
}
if (Object.preventExtensions) {
var objectPreventExtensionsAcceptsPrimitives = !throwsError(function () { Object.preventExtensions('foo'); });
if (!objectPreventExtensionsAcceptsPrimitives) {
var originalObjectPreventExtensions = Object.preventExtensions;
overrideNative(Object, 'preventExtensions', function preventExtensions(value) {
if (!Type.object(value)) { return value; }
return originalObjectPreventExtensions(value);
});
}
}
if (Object.isExtensible) {
var objectIsExtensibleAcceptsPrimitives = !throwsError(function () { Object.isExtensible('foo'); });
if (!objectIsExtensibleAcceptsPrimitives) {
var originalObjectIsExtensible = Object.isExtensible;
overrideNative(Object, 'isExtensible', function isExtensible(value) {
if (!Type.object(value)) { return false; }
return originalObjectIsExtensible(value);
});
}
}
if (Object.getPrototypeOf) {
var objectGetProtoAcceptsPrimitives = !throwsError(function () { Object.getPrototypeOf('foo'); });
if (!objectGetProtoAcceptsPrimitives) {
var originalGetProto = Object.getPrototypeOf;
overrideNative(Object, 'getPrototypeOf', function getPrototypeOf(value) {
return originalGetProto(ES.ToObject(value));
});
}
}
var hasFlags = supportsDescriptors && (function () {
var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags');
return desc && ES.IsCallable(desc.get);
}());
if (supportsDescriptors && !hasFlags) {
var regExpFlagsGetter = function flags() {
if (!ES.TypeIsObject(this)) {
throw new TypeError('Method called on incompatible type: must be an object.');
}
var result = '';
if (this.global) {
result += 'g';
}
if (this.ignoreCase) {
result += 'i';
}
if (this.multiline) {
result += 'm';
}
if (this.unicode) {
result += 'u';
}
if (this.sticky) {
result += 'y';
}
return result;
};
Value.getter(RegExp.prototype, 'flags', regExpFlagsGetter);
}
var regExpSupportsFlagsWithRegex = supportsDescriptors && valueOrFalseIfThrows(function () {
return String(new RegExp(/a/g, 'i')) === '/a/i';
});
var regExpNeedsToSupportSymbolMatch = hasSymbols && supportsDescriptors && (function () {
// Edge 0.12 supports flags fully, but does not support Symbol.match
var regex = /./;
regex[Symbol.match] = false;
return RegExp(regex) === regex;
}());
var regexToStringIsGeneric = valueOrFalseIfThrows(function () {
return RegExp.prototype.toString.call({ source: 'abc' }) === '/abc/';
});
var regexToStringSupportsGenericFlags = regexToStringIsGeneric && valueOrFalseIfThrows(function () {
return RegExp.prototype.toString.call({ source: 'a', flags: 'b' }) === '/a/b';
});
if (!regexToStringIsGeneric || !regexToStringSupportsGenericFlags) {
var origRegExpToString = RegExp.prototype.toString;
defineProperty(RegExp.prototype, 'toString', function toString() {
var R = ES.RequireObjectCoercible(this);
if (Type.regex(R)) {
return _call(origRegExpToString, R);
}
var pattern = $String(R.source);
var flags = $String(R.flags);
return '/' + pattern + '/' + flags;
}, true);
Value.preserveToString(RegExp.prototype.toString, origRegExpToString);
}
if (supportsDescriptors && (!regExpSupportsFlagsWithRegex || regExpNeedsToSupportSymbolMatch)) {
var flagsGetter = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get;
var sourceDesc = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source') || {};
var legacySourceGetter = function () { return this.source; }; // prior to it being a getter, it's own + nonconfigurable
var sourceGetter = ES.IsCallable(sourceDesc.get) ? sourceDesc.get : legacySourceGetter;
var OrigRegExp = RegExp;
var RegExpShim = (function () {
return function RegExp(pattern, flags) {
var patternIsRegExp = ES.IsRegExp(pattern);
var calledWithNew = this instanceof RegExp;
if (!calledWithNew && patternIsRegExp && typeof flags === 'undefined' && pattern.constructor === RegExp) {
return pattern;
}
var P = pattern;
var F = flags;
if (Type.regex(pattern)) {
P = ES.Call(sourceGetter, pattern);
F = typeof flags === 'undefined' ? ES.Call(flagsGetter, pattern) : flags;
return new RegExp(P, F);
} else if (patternIsRegExp) {
P = pattern.source;
F = typeof flags === 'undefined' ? pattern.flags : flags;
}
return new OrigRegExp(pattern, flags);
};
}());
wrapConstructor(OrigRegExp, RegExpShim, {
$input: true // Chrome < v39 & Opera < 26 have a nonstandard "$input" property
});
/* globals RegExp: true */
/* eslint-disable no-undef */
/* jshint -W020 */
RegExp = RegExpShim;
Value.redefine(globals, 'RegExp', RegExpShim);
/* jshint +W020 */
/* eslint-enable no-undef */
/* globals RegExp: false */
}
if (supportsDescriptors) {
var regexGlobals = {
input: '$_',
lastMatch: '$&',
lastParen: '$+',
leftContext: '$`',
rightContext: '$\''
};
_forEach(keys(regexGlobals), function (prop) {
if (prop in RegExp && !(regexGlobals[prop] in RegExp)) {
Value.getter(RegExp, regexGlobals[prop], function get() {
return RegExp[prop];
});
}
});
}
addDefaultSpecies(RegExp);
var inverseEpsilon = 1 / Number.EPSILON;
var roundTiesToEven = function roundTiesToEven(n) {
// Even though this reduces down to `return n`, it takes advantage of built-in rounding.
return (n + inverseEpsilon) - inverseEpsilon;
};
var BINARY_32_EPSILON = Math.pow(2, -23);
var BINARY_32_MAX_VALUE = Math.pow(2, 127) * (2 - BINARY_32_EPSILON);
var BINARY_32_MIN_VALUE = Math.pow(2, -126);
var numberCLZ = Number.prototype.clz;
delete Number.prototype.clz; // Safari 8 has Number#clz
var MathShims = {
acosh: function acosh(value) {
var x = Number(value);
if (Number.isNaN(x) || value < 1) { return NaN; }
if (x === 1) { return 0; }
if (x === Infinity) { return x; }
return _log(x / Math.E + _sqrt(x + 1) * _sqrt(x - 1) / Math.E) + 1;
},
asinh: function asinh(value) {
var x = Number(value);
if (x === 0 || !globalIsFinite(x)) {
return x;
}
return x < 0 ? -Math.asinh(-x) : _log(x + _sqrt(x * x + 1));
},
atanh: function atanh(value) {
var x = Number(value);
if (Number.isNaN(x) || x < -1 || x > 1) {
return NaN;
}
if (x === -1) { return -Infinity; }
if (x === 1) { return Infinity; }
if (x === 0) { return x; }
return 0.5 * _log((1 + x) / (1 - x));
},
cbrt: function cbrt(value) {
var x = Number(value);
if (x === 0) { return x; }
var negate = x < 0, result;
if (negate) { x = -x; }
if (x === Infinity) {
result = Infinity;
} else {
result = Math.exp(_log(x) / 3);
// from http://en.wikipedia.org/wiki/Cube_root#Numerical_methods
result = (x / (result * result) + (2 * result)) / 3;
}
return negate ? -result : result;
},
clz32: function clz32(value) {
// See https://bugs.ecmascript.org/show_bug.cgi?id=2465
var x = Number(value);
var number = ES.ToUint32(x);
if (number === 0) {
return 32;
}
return numberCLZ ? ES.Call(numberCLZ, number) : 31 - _floor(_log(number + 0.5) * Math.LOG2E);
},
cosh: function cosh(value) {
var x = Number(value);
if (x === 0) { return 1; } // +0 or -0
if (Number.isNaN(x)) { return NaN; }
if (!globalIsFinite(x)) { return Infinity; }
if (x < 0) { x = -x; }
if (x > 21) { return Math.exp(x) / 2; }
return (Math.exp(x) + Math.exp(-x)) / 2;
},
expm1: function expm1(value) {
var x = Number(value);
if (x === -Infinity) { return -1; }
if (!globalIsFinite(x) || x === 0) { return x; }
if (_abs(x) > 0.5) {
return Math.exp(x) - 1;
}
// A more precise approximation using Taylor series expansion
// from https://github.com/paulmillr/es6-shim/issues/314#issuecomment-70293986
var t = x;
var sum = 0;
var n = 1;
while (sum + t !== sum) {
sum += t;
n += 1;
t *= x / n;
}
return sum;
},
hypot: function hypot(x, y) {
var result = 0;
var largest = 0;
for (var i = 0; i < arguments.length; ++i) {
var value = _abs(Number(arguments[i]));
if (largest < value) {
result *= (largest / value) * (largest / value);
result += 1;
largest = value;
} else {
result += (value > 0 ? (value / largest) * (value / largest) : value);
}
}
return largest === Infinity ? Infinity : largest * _sqrt(result);
},
log2: function log2(value) {
return _log(value) * Math.LOG2E;
},
log10: function log10(value) {
return _log(value) * Math.LOG10E;
},
log1p: function log1p(value) {
var x = Number(value);
if (x < -1 || Number.isNaN(x)) { return NaN; }
if (x === 0 || x === Infinity) { return x; }
if (x === -1) { return -Infinity; }
return (1 + x) - 1 === 0 ? x : x * (_log(1 + x) / ((1 + x) - 1));
},
sign: function sign(value) {
var number = Number(value);
if (number === 0) { return number; }
if (Number.isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
},
sinh: function sinh(value) {
var x = Number(value);
if (!globalIsFinite(x) || x === 0) { return x; }
if (_abs(x) < 1) {
return (Math.expm1(x) - Math.expm1(-x)) / 2;
}
return (Math.exp(x - 1) - Math.exp(-x - 1)) * Math.E / 2;
},
tanh: function tanh(value) {
var x = Number(value);
if (Number.isNaN(x) || x === 0) { return x; }
// can exit early at +-20 as JS loses precision for true value at this integer
if (x >= 20) { return 1; }
if (x <= -20) { return -1; }
var a = Math.expm1(x);
var b = Math.expm1(-x);
if (a === Infinity) { return 1; }
if (b === Infinity) { return -1; }
return (a - b) / (Math.exp(x) + Math.exp(-x));
},
trunc: function trunc(value) {
var x = Number(value);
return x < 0 ? -_floor(-x) : _floor(x);
},
imul: function imul(x, y) {
// taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
var a = ES.ToUint32(x);
var b = ES.ToUint32(y);
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
// the shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
},
fround: function fround(x) {
var v = Number(x);
if (v === 0 || v === Infinity || v === -Infinity || numberIsNaN(v)) {
return v;
}
var sign = Math.sign(v);
var abs = _abs(v);
if (abs < BINARY_32_MIN_VALUE) {
return sign * roundTiesToEven(abs / BINARY_32_MIN_VALUE / BINARY_32_EPSILON) * BINARY_32_MIN_VALUE * BINARY_32_EPSILON;
}
// Veltkamp's splitting (?)
var a = (1 + BINARY_32_EPSILON / Number.EPSILON) * abs;
var result = a - (a - abs);
if (result > BINARY_32_MAX_VALUE || numberIsNaN(result)) {
return sign * Infinity;
}
return sign * result;
}
};
defineProperties(Math, MathShims);
// IE 11 TP has an imprecise log1p: reports Math.log1p(-1e-17) as 0
defineProperty(Math, 'log1p', MathShims.log1p, Math.log1p(-1e-17) !== -1e-17);
// IE 11 TP has an imprecise asinh: reports Math.asinh(-1e7) as not exactly equal to -Math.asinh(1e7)
defineProperty(Math, 'asinh', MathShims.asinh, Math.asinh(-1e7) !== -Math.asinh(1e7));
// Chrome 40 has an imprecise Math.tanh with very small numbers
defineProperty(Math, 'tanh', MathShims.tanh, Math.tanh(-2e-17) !== -2e-17);
// Chrome 40 loses Math.acosh precision with high numbers
defineProperty(Math, 'acosh', MathShims.acosh, Math.acosh(Number.MAX_VALUE) === Infinity);
// Firefox 38 on Windows
defineProperty(Math, 'cbrt', MathShims.cbrt, Math.abs(1 - Math.cbrt(1e-300) / 1e-100) / Number.EPSILON > 8);
// node 0.11 has an imprecise Math.sinh with very small numbers
defineProperty(Math, 'sinh', MathShims.sinh, Math.sinh(-2e-17) !== -2e-17);
// FF 35 on Linux reports 22025.465794806725 for Math.expm1(10)
var expm1OfTen = Math.expm1(10);
defineProperty(Math, 'expm1', MathShims.expm1, expm1OfTen > 22025.465794806719 || expm1OfTen < 22025.4657948067165168);
var origMathRound = Math.round;
// breaks in e.g. Safari 8, Internet Explorer 11, Opera 12
var roundHandlesBoundaryConditions = Math.round(0.5 - Number.EPSILON / 4) === 0 && Math.round(-0.5 + Number.EPSILON / 3.99) === 1;
// When engines use Math.floor(x + 0.5) internally, Math.round can be buggy for large integers.
// This behavior should be governed by "round to nearest, ties to even mode"
// see https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type
// These are the boundary cases where it breaks.
var smallestPositiveNumberWhereRoundBreaks = inverseEpsilon + 1;
var largestPositiveNumberWhereRoundBreaks = 2 * inverseEpsilon - 1;
var roundDoesNotIncreaseIntegers = [smallestPositiveNumberWhereRoundBreaks, largestPositiveNumberWhereRoundBreaks].every(function (num) {
return Math.round(num) === num;
});
defineProperty(Math, 'round', function round(x) {
var floor = _floor(x);
var ceil = floor === -1 ? -0 : floor + 1;
return x - floor < 0.5 ? floor : ceil;
}, !roundHandlesBoundaryConditions || !roundDoesNotIncreaseIntegers);
Value.preserveToString(Math.round, origMathRound);
var origImul = Math.imul;
if (Math.imul(0xffffffff, 5) !== -5) {
// Safari 6.1, at least, reports "0" for this value
Math.imul = MathShims.imul;
Value.preserveToString(Math.imul, origImul);
}
if (Math.imul.length !== 2) {
// Safari 8.0.4 has a length of 1
// fixed in https://bugs.webkit.org/show_bug.cgi?id=143658
overrideNative(Math, 'imul', function imul(x, y) {
return ES.Call(origImul, Math, arguments);
});
}
// Promises
// Simplest possible implementation; use a 3rd-party library if you
// want the best possible speed and/or long stack traces.
var PromiseShim = (function () {
var setTimeout = globals.setTimeout;
// some environments don't have setTimeout - no way to shim here.
if (typeof setTimeout !== 'function' && typeof setTimeout !== 'object') { return; }
ES.IsPromise = function (promise) {
if (!ES.TypeIsObject(promise)) {
return false;
}
if (typeof promise._promise === 'undefined') {
return false; // uninitialized, or missing our hidden field.
}
return true;
};
// "PromiseCapability" in the spec is what most promise implementations
// call a "deferred".
var PromiseCapability = function (C) {
if (!ES.IsConstructor(C)) {
throw new TypeError('Bad promise constructor');
}
var capability = this;
var resolver = function (resolve, reject) {
if (capability.resolve !== void 0 || capability.reject !== void 0) {
throw new TypeError('Bad Promise implementation!');
}
capability.resolve = resolve;
capability.reject = reject;
};
// Initialize fields to inform optimizers about the object shape.
capability.resolve = void 0;
capability.reject = void 0;
capability.promise = new C(resolver);
if (!(ES.IsCallable(capability.resolve) && ES.IsCallable(capability.reject))) {
throw new TypeError('Bad promise constructor');
}
};
// find an appropriate setImmediate-alike
var makeZeroTimeout;
/*global window */
if (typeof window !== 'undefined' && ES.IsCallable(window.postMessage)) {
makeZeroTimeout = function () {
// from http://dbaron.org/log/20100309-faster-timeouts
var timeouts = [];
var messageName = 'zero-timeout-message';
var setZeroTimeout = function (fn) {
_push(timeouts, fn);
window.postMessage(messageName, '*');
};
var handleMessage = function (event) {
if (event.source === window && event.data === messageName) {
event.stopPropagation();
if (timeouts.length === 0) { return; }
var fn = _shift(timeouts);
fn();
}
};
window.addEventListener('message', handleMessage, true);
return setZeroTimeout;
};
}
var makePromiseAsap = function () {
// An efficient task-scheduler based on a pre-existing Promise
// implementation, which we can use even if we override the
// global Promise below (in order to workaround bugs)
// https://github.com/Raynos/observ-hash/issues/2#issuecomment-35857671
var P = globals.Promise;
var pr = P && P.resolve && P.resolve();
return pr && function (task) {
return pr.then(task);
};
};
/*global process */
/* jscs:disable disallowMultiLineTernary */
var enqueue = ES.IsCallable(globals.setImmediate) ?
globals.setImmediate :
typeof process === 'object' && process.nextTick ? process.nextTick :
makePromiseAsap() ||
(ES.IsCallable(makeZeroTimeout) ? makeZeroTimeout() :
function (task) { setTimeout(task, 0); }); // fallback
/* jscs:enable disallowMultiLineTernary */
// Constants for Promise implementation
var PROMISE_IDENTITY = function (x) { return x; };
var PROMISE_THROWER = function (e) { throw e; };
var PROMISE_PENDING = 0;
var PROMISE_FULFILLED = 1;
var PROMISE_REJECTED = 2;
// We store fulfill/reject handlers and capabilities in a single array.
var PROMISE_FULFILL_OFFSET = 0;
var PROMISE_REJECT_OFFSET = 1;
var PROMISE_CAPABILITY_OFFSET = 2;
// This is used in an optimization for chaining promises via then.
var PROMISE_FAKE_CAPABILITY = {};
var enqueuePromiseReactionJob = function (handler, capability, argument) {
enqueue(function () {
promiseReactionJob(handler, capability, argument);
});
};
var promiseReactionJob = function (handler, promiseCapability, argument) {
var handlerResult, f;
if (promiseCapability === PROMISE_FAKE_CAPABILITY) {
// Fast case, when we don't actually need to chain through to a
// (real) promiseCapability.
return handler(argument);
}
try {
handlerResult = handler(argument);
f = promiseCapability.resolve;
} catch (e) {
handlerResult = e;
f = promiseCapability.reject;
}
f(handlerResult);
};
var fulfillPromise = function (promise, value) {
var _promise = promise._promise;
var length = _promise.reactionLength;
if (length > 0) {
enqueuePromiseReactionJob(
_promise.fulfillReactionHandler0,
_promise.reactionCapability0,
value
);
_promise.fulfillReactionHandler0 = void 0;
_promise.rejectReactions0 = void 0;
_promise.reactionCapability0 = void 0;
if (length > 1) {
for (var i = 1, idx = 0; i < length; i++, idx += 3) {
enqueuePromiseReactionJob(
_promise[idx + PROMISE_FULFILL_OFFSET],
_promise[idx + PROMISE_CAPABILITY_OFFSET],
value
);
promise[idx + PROMISE_FULFILL_OFFSET] = void 0;
promise[idx + PROMISE_REJECT_OFFSET] = void 0;
promise[idx + PROMISE_CAPABILITY_OFFSET] = void 0;
}
}
}
_promise.result = value;
_promise.state = PROMISE_FULFILLED;
_promise.reactionLength = 0;
};
var rejectPromise = function (promise, reason) {
var _promise = promise._promise;
var length = _promise.reactionLength;
if (length > 0) {
enqueuePromiseReactionJob(
_promise.rejectReactionHandler0,
_promise.reactionCapability0,
reason
);
_promise.fulfillReactionHandler0 = void 0;
_promise.rejectReactions0 = void 0;
_promise.reactionCapability0 = void 0;
if (length > 1) {
for (var i = 1, idx = 0; i < length; i++, idx += 3) {
enqueuePromiseReactionJob(
_promise[idx + PROMISE_REJECT_OFFSET],
_promise[idx + PROMISE_CAPABILITY_OFFSET],
reason
);
promise[idx + PROMISE_FULFILL_OFFSET] = void 0;
promise[idx + PROMISE_REJECT_OFFSET] = void 0;
promise[idx + PROMISE_CAPABILITY_OFFSET] = void 0;
}
}
}
_promise.result = reason;
_promise.state = PROMISE_REJECTED;
_promise.reactionLength = 0;
};
var createResolvingFunctions = function (promise) {
var alreadyResolved = false;
var resolve = function (resolution) {
var then;
if (alreadyResolved) { return; }
alreadyResolved = true;
if (resolution === promise) {
return rejectPromise(promise, new TypeError('Self resolution'));
}
if (!ES.TypeIsObject(resolution)) {
return fulfillPromise(promise, resolution);
}
try {
then = resolution.then;
} catch (e) {
return rejectPromise(promise, e);
}
if (!ES.IsCallable(then)) {
return fulfillPromise(promise, resolution);
}
enqueue(function () {
promiseResolveThenableJob(promise, resolution, then);
});
};
var reject = function (reason) {
if (alreadyResolved) { return; }
alreadyResolved = true;
return rejectPromise(promise, reason);
};
return { resolve: resolve, reject: reject };
};
var optimizedThen = function (then, thenable, resolve, reject) {
// Optimization: since we discard the result, we can pass our
// own then implementation a special hint to let it know it
// doesn't have to create it. (The PROMISE_FAKE_CAPABILITY
// object is local to this implementation and unforgeable outside.)
if (then === Promise$prototype$then) {
_call(then, thenable, resolve, reject, PROMISE_FAKE_CAPABILITY);
} else {
_call(then, thenable, resolve, reject);
}
};
var promiseResolveThenableJob = function (promise, thenable, then) {
var resolvingFunctions = createResolvingFunctions(promise);
var resolve = resolvingFunctions.resolve;
var reject = resolvingFunctions.reject;
try {
optimizedThen(then, thenable, resolve, reject);
} catch (e) {
reject(e);
}
};
var Promise$prototype, Promise$prototype$then;
var Promise = (function () {
var PromiseShim = function Promise(resolver) {
if (!(this instanceof PromiseShim)) {
throw new TypeError('Constructor Promise requires "new"');
}
if (this && this._promise) {
throw new TypeError('Bad construction');
}
// see https://bugs.ecmascript.org/show_bug.cgi?id=2482
if (!ES.IsCallable(resolver)) {
throw new TypeError('not a valid resolver');
}
var promise = emulateES6construct(this, PromiseShim, Promise$prototype, {
_promise: {
result: void 0,
state: PROMISE_PENDING,
// The first member of the "reactions" array is inlined here,
// since most promises only have one reaction.
// We've also exploded the 'reaction' object to inline the
// "handler" and "capability" fields, since both fulfill and
// reject reactions share the same capability.
reactionLength: 0,
fulfillReactionHandler0: void 0,
rejectReactionHandler0: void 0,
reactionCapability0: void 0
}
});
var resolvingFunctions = createResolvingFunctions(promise);
var reject = resolvingFunctions.reject;
try {
resolver(resolvingFunctions.resolve, reject);
} catch (e) {
reject(e);
}
return promise;
};
return PromiseShim;
}());
Promise$prototype = Promise.prototype;
var _promiseAllResolver = function (index, values, capability, remaining) {
var alreadyCalled = false;
return function (x) {
if (alreadyCalled) { return; }
alreadyCalled = true;
values[index] = x;
if ((--remaining.count) === 0) {
var resolve = capability.resolve;
resolve(values); // call w/ this===undefined
}
};
};
var performPromiseAll = function (iteratorRecord, C, resultCapability) {
var it = iteratorRecord.iterator;
var values = [], remaining = { count: 1 }, next, nextValue;
var index = 0;
while (true) {
try {
next = ES.IteratorStep(it);
if (next === false) {
iteratorRecord.done = true;
break;
}
nextValue = next.value;
} catch (e) {
iteratorRecord.done = true;
throw e;
}
values[index] = void 0;
var nextPromise = C.resolve(nextValue);
var resolveElement = _promiseAllResolver(
index, values, resultCapability, remaining
);
remaining.count += 1;
optimizedThen(nextPromise.then, nextPromise, resolveElement, resultCapability.reject);
index += 1;
}
if ((--remaining.count) === 0) {
var resolve = resultCapability.resolve;
resolve(values); // call w/ this===undefined
}
return resultCapability.promise;
};
var performPromiseRace = function (iteratorRecord, C, resultCapability) {
var it = iteratorRecord.iterator, next, nextValue, nextPromise;
while (true) {
try {
next = ES.IteratorStep(it);
if (next === false) {
// NOTE: If iterable has no items, resulting promise will never
// resolve; see:
// https://github.com/domenic/promises-unwrapping/issues/75
// https://bugs.ecmascript.org/show_bug.cgi?id=2515
iteratorRecord.done = true;
break;
}
nextValue = next.value;
} catch (e) {
iteratorRecord.done = true;
throw e;
}
nextPromise = C.resolve(nextValue);
optimizedThen(nextPromise.then, nextPromise, resultCapability.resolve, resultCapability.reject);
}
return resultCapability.promise;
};
defineProperties(Promise, {
all: function all(iterable) {
var C = this;
if (!ES.TypeIsObject(C)) {
throw new TypeError('Promise is not object');
}
var capability = new PromiseCapability(C);
var iterator, iteratorRecord;
try {
iterator = ES.GetIterator(iterable);
iteratorRecord = { iterator: iterator, done: false };
return performPromiseAll(iteratorRecord, C, capability);
} catch (e) {
var exception = e;
if (iteratorRecord && !iteratorRecord.done) {
try {
ES.IteratorClose(iterator, true);
} catch (ee) {
exception = ee;
}
}
var reject = capability.reject;
reject(exception);
return capability.promise;
}
},
race: function race(iterable) {
var C = this;
if (!ES.TypeIsObject(C)) {
throw new TypeError('Promise is not object');
}
var capability = new PromiseCapability(C);
var iterator, iteratorRecord;
try {
iterator = ES.GetIterator(iterable);
iteratorRecord = { iterator: iterator, done: false };
return performPromiseRace(iteratorRecord, C, capability);
} catch (e) {
var exception = e;
if (iteratorRecord && !iteratorRecord.done) {
try {
ES.IteratorClose(iterator, true);
} catch (ee) {
exception = ee;
}
}
var reject = capability.reject;
reject(exception);
return capability.promise;
}
},
reject: function reject(reason) {
var C = this;
if (!ES.TypeIsObject(C)) {
throw new TypeError('Bad promise constructor');
}
var capability = new PromiseCapability(C);
var rejectFunc = capability.reject;
rejectFunc(reason); // call with this===undefined
return capability.promise;
},
resolve: function resolve(v) {
// See https://esdiscuss.org/topic/fixing-promise-resolve for spec
var C = this;
if (!ES.TypeIsObject(C)) {
throw new TypeError('Bad promise constructor');
}
if (ES.IsPromise(v)) {
var constructor = v.constructor;
if (constructor === C) { return v; }
}
var capability = new PromiseCapability(C);
var resolveFunc = capability.resolve;
resolveFunc(v); // call with this===undefined
return capability.promise;
}
});
defineProperties(Promise$prototype, {
'catch': function (onRejected) {
return this.then(null, onRejected);
},
then: function then(onFulfilled, onRejected) {
var promise = this;
if (!ES.IsPromise(promise)) { throw new TypeError('not a promise'); }
var C = ES.SpeciesConstructor(promise, Promise);
var resultCapability;
var returnValueIsIgnored = arguments.length > 2 && arguments[2] === PROMISE_FAKE_CAPABILITY;
if (returnValueIsIgnored && C === Promise) {
resultCapability = PROMISE_FAKE_CAPABILITY;
} else {
resultCapability = new PromiseCapability(C);
}
// PerformPromiseThen(promise, onFulfilled, onRejected, resultCapability)
// Note that we've split the 'reaction' object into its two
// components, "capabilities" and "handler"
// "capabilities" is always equal to `resultCapability`
var fulfillReactionHandler = ES.IsCallable(onFulfilled) ? onFulfilled : PROMISE_IDENTITY;
var rejectReactionHandler = ES.IsCallable(onRejected) ? onRejected : PROMISE_THROWER;
var _promise = promise._promise;
var value;
if (_promise.state === PROMISE_PENDING) {
if (_promise.reactionLength === 0) {
_promise.fulfillReactionHandler0 = fulfillReactionHandler;
_promise.rejectReactionHandler0 = rejectReactionHandler;
_promise.reactionCapability0 = resultCapability;
} else {
var idx = 3 * (_promise.reactionLength - 1);
_promise[idx + PROMISE_FULFILL_OFFSET] = fulfillReactionHandler;
_promise[idx + PROMISE_REJECT_OFFSET] = rejectReactionHandler;
_promise[idx + PROMISE_CAPABILITY_OFFSET] = resultCapability;
}
_promise.reactionLength += 1;
} else if (_promise.state === PROMISE_FULFILLED) {
value = _promise.result;
enqueuePromiseReactionJob(
fulfillReactionHandler, resultCapability, value
);
} else if (_promise.state === PROMISE_REJECTED) {
value = _promise.result;
enqueuePromiseReactionJob(
rejectReactionHandler, resultCapability, value
);
} else {
throw new TypeError('unexpected Promise state');
}
return resultCapability.promise;
}
});
// This helps the optimizer by ensuring that methods which take
// capabilities aren't polymorphic.
PROMISE_FAKE_CAPABILITY = new PromiseCapability(Promise);
Promise$prototype$then = Promise$prototype.then;
return Promise;
}());
// Chrome's native Promise has extra methods that it shouldn't have. Let's remove them.
if (globals.Promise) {
delete globals.Promise.accept;
delete globals.Promise.defer;
delete globals.Promise.prototype.chain;
}
if (typeof PromiseShim === 'function') {
// export the Promise constructor.
defineProperties(globals, { Promise: PromiseShim });
// In Chrome 33 (and thereabouts) Promise is defined, but the
// implementation is buggy in a number of ways. Let's check subclassing
// support to see if we have a buggy implementation.
var promiseSupportsSubclassing = supportsSubclassing(globals.Promise, function (S) {
return S.resolve(42).then(function () {}) instanceof S;
});
var promiseIgnoresNonFunctionThenCallbacks = !throwsError(function () { globals.Promise.reject(42).then(null, 5).then(null, noop); });
var promiseRequiresObjectContext = throwsError(function () { globals.Promise.call(3, noop); });
// Promise.resolve() was errata'ed late in the ES6 process.
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1170742
// https://code.google.com/p/v8/issues/detail?id=4161
// It serves as a proxy for a number of other bugs in early Promise
// implementations.
var promiseResolveBroken = (function (Promise) {
var p = Promise.resolve(5);
p.constructor = {};
var p2 = Promise.resolve(p);
try {
p2.then(null, noop).then(null, noop); // avoid "uncaught rejection" warnings in console
} catch (e) {
return true; // v8 native Promises break here https://code.google.com/p/chromium/issues/detail?id=575314
}
return p === p2; // This *should* be false!
}(globals.Promise));
// Chrome 46 (probably older too) does not retrieve a thenable's .then synchronously
var getsThenSynchronously = supportsDescriptors && (function () {
var count = 0;
var thenable = Object.defineProperty({}, 'then', { get: function () { count += 1; } });
Promise.resolve(thenable);
return count === 1;
}());
var BadResolverPromise = function BadResolverPromise(executor) {
var p = new Promise(executor);
executor(3, function () {});
this.then = p.then;
this.constructor = BadResolverPromise;
};
BadResolverPromise.prototype = Promise.prototype;
BadResolverPromise.all = Promise.all;
// Chrome Canary 49 (probably older too) has some implementation bugs
var hasBadResolverPromise = valueOrFalseIfThrows(function () {
return !!BadResolverPromise.all([1, 2]);
});
if (!promiseSupportsSubclassing || !promiseIgnoresNonFunctionThenCallbacks ||
!promiseRequiresObjectContext || promiseResolveBroken ||
!getsThenSynchronously || hasBadResolverPromise) {
/* globals Promise: true */
/* eslint-disable no-undef */
/* jshint -W020 */
Promise = PromiseShim;
/* jshint +W020 */
/* eslint-enable no-undef */
/* globals Promise: false */
overrideNative(globals, 'Promise', PromiseShim);
}
if (Promise.all.length !== 1) {
var origAll = Promise.all;
overrideNative(Promise, 'all', function all(iterable) {
return ES.Call(origAll, this, arguments);
});
}
if (Promise.race.length !== 1) {
var origRace = Promise.race;
overrideNative(Promise, 'race', function race(iterable) {
return ES.Call(origRace, this, arguments);
});
}
if (Promise.resolve.length !== 1) {
var origResolve = Promise.resolve;
overrideNative(Promise, 'resolve', function resolve(x) {
return ES.Call(origResolve, this, arguments);
});
}
if (Promise.reject.length !== 1) {
var origReject = Promise.reject;
overrideNative(Promise, 'reject', function reject(r) {
return ES.Call(origReject, this, arguments);
});
}
ensureEnumerable(Promise, 'all');
ensureEnumerable(Promise, 'race');
ensureEnumerable(Promise, 'resolve');
ensureEnumerable(Promise, 'reject');
addDefaultSpecies(Promise);
}
// Map and Set require a true ES5 environment
// Their fast path also requires that the environment preserve
// property insertion order, which is not guaranteed by the spec.
var testOrder = function (a) {
var b = keys(_reduce(a, function (o, k) {
o[k] = true;
return o;
}, {}));
return a.join(':') === b.join(':');
};
var preservesInsertionOrder = testOrder(['z', 'a', 'bb']);
// some engines (eg, Chrome) only preserve insertion order for string keys
var preservesNumericInsertionOrder = testOrder(['z', 1, 'a', '3', 2]);
if (supportsDescriptors) {
var fastkey = function fastkey(key) {
if (!preservesInsertionOrder) {
return null;
}
if (typeof key === 'undefined' || key === null) {
return '^' + ES.ToString(key);
} else if (typeof key === 'string') {
return '$' + key;
} else if (typeof key === 'number') {
// note that -0 will get coerced to "0" when used as a property key
if (!preservesNumericInsertionOrder) {
return 'n' + key;
}
return key;
} else if (typeof key === 'boolean') {
return 'b' + key;
}
return null;
};
var emptyObject = function emptyObject() {
// accomodate some older not-quite-ES5 browsers
return Object.create ? Object.create(null) : {};
};
var addIterableToMap = function addIterableToMap(MapConstructor, map, iterable) {
if (isArray(iterable) || Type.string(iterable)) {
_forEach(iterable, function (entry) {
if (!ES.TypeIsObject(entry)) {
throw new TypeError('Iterator value ' + entry + ' is not an entry object');
}
map.set(entry[0], entry[1]);
});
} else if (iterable instanceof MapConstructor) {
_call(MapConstructor.prototype.forEach, iterable, function (value, key) {
map.set(key, value);
});
} else {
var iter, adder;
if (iterable !== null && typeof iterable !== 'undefined') {
adder = map.set;
if (!ES.IsCallable(adder)) { throw new TypeError('bad map'); }
iter = ES.GetIterator(iterable);
}
if (typeof iter !== 'undefined') {
while (true) {
var next = ES.IteratorStep(iter);
if (next === false) { break; }
var nextItem = next.value;
try {
if (!ES.TypeIsObject(nextItem)) {
throw new TypeError('Iterator value ' + nextItem + ' is not an entry object');
}
_call(adder, map, nextItem[0], nextItem[1]);
} catch (e) {
ES.IteratorClose(iter, true);
throw e;
}
}
}
}
};
var addIterableToSet = function addIterableToSet(SetConstructor, set, iterable) {
if (isArray(iterable) || Type.string(iterable)) {
_forEach(iterable, function (value) {
set.add(value);
});
} else if (iterable instanceof SetConstructor) {
_call(SetConstructor.prototype.forEach, iterable, function (value) {
set.add(value);
});
} else {
var iter, adder;
if (iterable !== null && typeof iterable !== 'undefined') {
adder = set.add;
if (!ES.IsCallable(adder)) { throw new TypeError('bad set'); }
iter = ES.GetIterator(iterable);
}
if (typeof iter !== 'undefined') {
while (true) {
var next = ES.IteratorStep(iter);
if (next === false) { break; }
var nextValue = next.value;
try {
_call(adder, set, nextValue);
} catch (e) {
ES.IteratorClose(iter, true);
throw e;
}
}
}
}
};
var collectionShims = {
Map: (function () {
var empty = {};
var MapEntry = function MapEntry(key, value) {
this.key = key;
this.value = value;
this.next = null;
this.prev = null;
};
MapEntry.prototype.isRemoved = function isRemoved() {
return this.key === empty;
};
var isMap = function isMap(map) {
return !!map._es6map;
};
var requireMapSlot = function requireMapSlot(map, method) {
if (!ES.TypeIsObject(map) || !isMap(map)) {
throw new TypeError('Method Map.prototype.' + method + ' called on incompatible receiver ' + ES.ToString(map));
}
};
var MapIterator = function MapIterator(map, kind) {
requireMapSlot(map, '[[MapIterator]]');
this.head = map._head;
this.i = this.head;
this.kind = kind;
};
MapIterator.prototype = {
next: function next() {
var i = this.i, kind = this.kind, head = this.head, result;
if (typeof this.i === 'undefined') {
return { value: void 0, done: true };
}
while (i.isRemoved() && i !== head) {
// back up off of removed entries
i = i.prev;
}
// advance to next unreturned element.
while (i.next !== head) {
i = i.next;
if (!i.isRemoved()) {
if (kind === 'key') {
result = i.key;
} else if (kind === 'value') {
result = i.value;
} else {
result = [i.key, i.value];
}
this.i = i;
return { value: result, done: false };
}
}
// once the iterator is done, it is done forever.
this.i = void 0;
return { value: void 0, done: true };
}
};
addIterator(MapIterator.prototype);
var Map$prototype;
var MapShim = function Map() {
if (!(this instanceof Map)) {
throw new TypeError('Constructor Map requires "new"');
}
if (this && this._es6map) {
throw new TypeError('Bad construction');
}
var map = emulateES6construct(this, Map, Map$prototype, {
_es6map: true,
_head: null,
_storage: emptyObject(),
_size: 0
});
var head = new MapEntry(null, null);
// circular doubly-linked list.
head.next = head.prev = head;
map._head = head;
// Optionally initialize map from iterable
if (arguments.length > 0) {
addIterableToMap(Map, map, arguments[0]);
}
return map;
};
Map$prototype = MapShim.prototype;
Value.getter(Map$prototype, 'size', function () {
if (typeof this._size === 'undefined') {
throw new TypeError('size method called on incompatible Map');
}
return this._size;
});
defineProperties(Map$prototype, {
get: function get(key) {
requireMapSlot(this, 'get');
var fkey = fastkey(key);
if (fkey !== null) {
// fast O(1) path
var entry = this._storage[fkey];
if (entry) {
return entry.value;
} else {
return;
}
}
var head = this._head, i = head;
while ((i = i.next) !== head) {
if (ES.SameValueZero(i.key, key)) {
return i.value;
}
}
},
has: function has(key) {
requireMapSlot(this, 'has');
var fkey = fastkey(key);
if (fkey !== null) {
// fast O(1) path
return typeof this._storage[fkey] !== 'undefined';
}
var head = this._head, i = head;
while ((i = i.next) !== head) {
if (ES.SameValueZero(i.key, key)) {
return true;
}
}
return false;
},
set: function set(key, value) {
requireMapSlot(this, 'set');
var head = this._head, i = head, entry;
var fkey = fastkey(key);
if (fkey !== null) {
// fast O(1) path
if (typeof this._storage[fkey] !== 'undefined') {
this._storage[fkey].value = value;
return this;
} else {
entry = this._storage[fkey] = new MapEntry(key, value);
i = head.prev;
// fall through
}
}
while ((i = i.next) !== head) {
if (ES.SameValueZero(i.key, key)) {
i.value = value;
return this;
}
}
entry = entry || new MapEntry(key, value);
if (ES.SameValue(-0, key)) {
entry.key = +0; // coerce -0 to +0 in entry
}
entry.next = this._head;
entry.prev = this._head.prev;
entry.prev.next = entry;
entry.next.prev = entry;
this._size += 1;
return this;
},
'delete': function (key) {
requireMapSlot(this, 'delete');
var head = this._head, i = head;
var fkey = fastkey(key);
if (fkey !== null) {
// fast O(1) path
if (typeof this._storage[fkey] === 'undefined') {
return false;
}
i = this._storage[fkey].prev;
delete this._storage[fkey];
// fall through
}
while ((i = i.next) !== head) {
if (ES.SameValueZero(i.key, key)) {
i.key = i.value = empty;
i.prev.next = i.next;
i.next.prev = i.prev;
this._size -= 1;
return true;
}
}
return false;
},
clear: function clear() {
requireMapSlot(this, 'clear');
this._size = 0;
this._storage = emptyObject();
var head = this._head, i = head, p = i.next;
while ((i = p) !== head) {
i.key = i.value = empty;
p = i.next;
i.next = i.prev = head;
}
head.next = head.prev = head;
},
keys: function keys() {
requireMapSlot(this, 'keys');
return new MapIterator(this, 'key');
},
values: function values() {
requireMapSlot(this, 'values');
return new MapIterator(this, 'value');
},
entries: function entries() {
requireMapSlot(this, 'entries');
return new MapIterator(this, 'key+value');
},
forEach: function forEach(callback) {
requireMapSlot(this, 'forEach');
var context = arguments.length > 1 ? arguments[1] : null;
var it = this.entries();
for (var entry = it.next(); !entry.done; entry = it.next()) {
if (context) {
_call(callback, context, entry.value[1], entry.value[0], this);
} else {
callback(entry.value[1], entry.value[0], this);
}
}
}
});
addIterator(Map$prototype, Map$prototype.entries);
return MapShim;
}()),
Set: (function () {
var isSet = function isSet(set) {
return set._es6set && typeof set._storage !== 'undefined';
};
var requireSetSlot = function requireSetSlot(set, method) {
if (!ES.TypeIsObject(set) || !isSet(set)) {
// https://github.com/paulmillr/es6-shim/issues/176
throw new TypeError('Set.prototype.' + method + ' called on incompatible receiver ' + ES.ToString(set));
}
};
// Creating a Map is expensive. To speed up the common case of
// Sets containing only string or numeric keys, we use an object
// as backing storage and lazily create a full Map only when
// required.
var Set$prototype;
var SetShim = function Set() {
if (!(this instanceof Set)) {
throw new TypeError('Constructor Set requires "new"');
}
if (this && this._es6set) {
throw new TypeError('Bad construction');
}
var set = emulateES6construct(this, Set, Set$prototype, {
_es6set: true,
'[[SetData]]': null,
_storage: emptyObject()
});
if (!set._es6set) {
throw new TypeError('bad set');
}
// Optionally initialize Set from iterable
if (arguments.length > 0) {
addIterableToSet(Set, set, arguments[0]);
}
return set;
};
Set$prototype = SetShim.prototype;
var decodeKey = function (key) {
var k = key;
if (k === '^null') {
return null;
} else if (k === '^undefined') {
return void 0;
} else {
var first = k.charAt(0);
if (first === '$') {
return _strSlice(k, 1);
} else if (first === 'n') {
return +_strSlice(k, 1);
} else if (first === 'b') {
return k === 'btrue';
}
}
return +k;
};
// Switch from the object backing storage to a full Map.
var ensureMap = function ensureMap(set) {
if (!set['[[SetData]]']) {
var m = set['[[SetData]]'] = new collectionShims.Map();
_forEach(keys(set._storage), function (key) {
var k = decodeKey(key);
m.set(k, k);
});
set['[[SetData]]'] = m;
}
set._storage = null; // free old backing storage
};
Value.getter(SetShim.prototype, 'size', function () {
requireSetSlot(this, 'size');
if (this._storage) {
return keys(this._storage).length;
}
ensureMap(this);
return this['[[SetData]]'].size;
});
defineProperties(SetShim.prototype, {
has: function has(key) {
requireSetSlot(this, 'has');
var fkey;
if (this._storage && (fkey = fastkey(key)) !== null) {
return !!this._storage[fkey];
}
ensureMap(this);
return this['[[SetData]]'].has(key);
},
add: function add(key) {
requireSetSlot(this, 'add');
var fkey;
if (this._storage && (fkey = fastkey(key)) !== null) {
this._storage[fkey] = true;
return this;
}
ensureMap(this);
this['[[SetData]]'].set(key, key);
return this;
},
'delete': function (key) {
requireSetSlot(this, 'delete');
var fkey;
if (this._storage && (fkey = fastkey(key)) !== null) {
var hasFKey = _hasOwnProperty(this._storage, fkey);
return (delete this._storage[fkey]) && hasFKey;
}
ensureMap(this);
return this['[[SetData]]']['delete'](key);
},
clear: function clear() {
requireSetSlot(this, 'clear');
if (this._storage) {
this._storage = emptyObject();
}
if (this['[[SetData]]']) {
this['[[SetData]]'].clear();
}
},
values: function values() {
requireSetSlot(this, 'values');
ensureMap(this);
return this['[[SetData]]'].values();
},
entries: function entries() {
requireSetSlot(this, 'entries');
ensureMap(this);
return this['[[SetData]]'].entries();
},
forEach: function forEach(callback) {
requireSetSlot(this, 'forEach');
var context = arguments.length > 1 ? arguments[1] : null;
var entireSet = this;
ensureMap(entireSet);
this['[[SetData]]'].forEach(function (value, key) {
if (context) {
_call(callback, context, key, key, entireSet);
} else {
callback(key, key, entireSet);
}
});
}
});
defineProperty(SetShim.prototype, 'keys', SetShim.prototype.values, true);
addIterator(SetShim.prototype, SetShim.prototype.values);
return SetShim;
}())
};
if (globals.Map || globals.Set) {
// Safari 8, for example, doesn't accept an iterable.
var mapAcceptsArguments = valueOrFalseIfThrows(function () { return new Map([[1, 2]]).get(1) === 2; });
if (!mapAcceptsArguments) {
var OrigMapNoArgs = globals.Map;
globals.Map = function Map() {
if (!(this instanceof Map)) {
throw new TypeError('Constructor Map requires "new"');
}
var m = new OrigMapNoArgs();
if (arguments.length > 0) {
addIterableToMap(Map, m, arguments[0]);
}
delete m.constructor;
Object.setPrototypeOf(m, globals.Map.prototype);
return m;
};
globals.Map.prototype = create(OrigMapNoArgs.prototype);
defineProperty(globals.Map.prototype, 'constructor', globals.Map, true);
Value.preserveToString(globals.Map, OrigMapNoArgs);
}
var testMap = new Map();
var mapUsesSameValueZero = (function () {
// Chrome 38-42, node 0.11/0.12, iojs 1/2 also have a bug when the Map has a size > 4
var m = new Map([[1, 0], [2, 0], [3, 0], [4, 0]]);
m.set(-0, m);
return m.get(0) === m && m.get(-0) === m && m.has(0) && m.has(-0);
}());
var mapSupportsChaining = testMap.set(1, 2) === testMap;
if (!mapUsesSameValueZero || !mapSupportsChaining) {
var origMapSet = Map.prototype.set;
overrideNative(Map.prototype, 'set', function set(k, v) {
_call(origMapSet, this, k === 0 ? 0 : k, v);
return this;
});
}
if (!mapUsesSameValueZero) {
var origMapGet = Map.prototype.get;
var origMapHas = Map.prototype.has;
defineProperties(Map.prototype, {
get: function get(k) {
return _call(origMapGet, this, k === 0 ? 0 : k);
},
has: function has(k) {
return _call(origMapHas, this, k === 0 ? 0 : k);
}
}, true);
Value.preserveToString(Map.prototype.get, origMapGet);
Value.preserveToString(Map.prototype.has, origMapHas);
}
var testSet = new Set();
var setUsesSameValueZero = (function (s) {
s['delete'](0);
s.add(-0);
return !s.has(0);
}(testSet));
var setSupportsChaining = testSet.add(1) === testSet;
if (!setUsesSameValueZero || !setSupportsChaining) {
var origSetAdd = Set.prototype.add;
Set.prototype.add = function add(v) {
_call(origSetAdd, this, v === 0 ? 0 : v);
return this;
};
Value.preserveToString(Set.prototype.add, origSetAdd);
}
if (!setUsesSameValueZero) {
var origSetHas = Set.prototype.has;
Set.prototype.has = function has(v) {
return _call(origSetHas, this, v === 0 ? 0 : v);
};
Value.preserveToString(Set.prototype.has, origSetHas);
var origSetDel = Set.prototype['delete'];
Set.prototype['delete'] = function SetDelete(v) {
return _call(origSetDel, this, v === 0 ? 0 : v);
};
Value.preserveToString(Set.prototype['delete'], origSetDel);
}
var mapSupportsSubclassing = supportsSubclassing(globals.Map, function (M) {
var m = new M([]);
// Firefox 32 is ok with the instantiating the subclass but will
// throw when the map is used.
m.set(42, 42);
return m instanceof M;
});
var mapFailsToSupportSubclassing = Object.setPrototypeOf && !mapSupportsSubclassing; // without Object.setPrototypeOf, subclassing is not possible
var mapRequiresNew = (function () {
try {
return !(globals.Map() instanceof globals.Map);
} catch (e) {
return e instanceof TypeError;
}
}());
if (globals.Map.length !== 0 || mapFailsToSupportSubclassing || !mapRequiresNew) {
var OrigMap = globals.Map;
globals.Map = function Map() {
if (!(this instanceof Map)) {
throw new TypeError('Constructor Map requires "new"');
}
var m = new OrigMap();
if (arguments.length > 0) {
addIterableToMap(Map, m, arguments[0]);
}
delete m.constructor;
Object.setPrototypeOf(m, Map.prototype);
return m;
};
globals.Map.prototype = OrigMap.prototype;
defineProperty(globals.Map.prototype, 'constructor', globals.Map, true);
Value.preserveToString(globals.Map, OrigMap);
}
var setSupportsSubclassing = supportsSubclassing(globals.Set, function (S) {
var s = new S([]);
s.add(42, 42);
return s instanceof S;
});
var setFailsToSupportSubclassing = Object.setPrototypeOf && !setSupportsSubclassing; // without Object.setPrototypeOf, subclassing is not possible
var setRequiresNew = (function () {
try {
return !(globals.Set() instanceof globals.Set);
} catch (e) {
return e instanceof TypeError;
}
}());
if (globals.Set.length !== 0 || setFailsToSupportSubclassing || !setRequiresNew) {
var OrigSet = globals.Set;
globals.Set = function Set() {
if (!(this instanceof Set)) {
throw new TypeError('Constructor Set requires "new"');
}
var s = new OrigSet();
if (arguments.length > 0) {
addIterableToSet(Set, s, arguments[0]);
}
delete s.constructor;
Object.setPrototypeOf(s, Set.prototype);
return s;
};
globals.Set.prototype = OrigSet.prototype;
defineProperty(globals.Set.prototype, 'constructor', globals.Set, true);
Value.preserveToString(globals.Set, OrigSet);
}
var mapIterationThrowsStopIterator = !valueOrFalseIfThrows(function () {
return (new Map()).keys().next().done;
});
/*
- In Firefox < 23, Map#size is a function.
- In all current Firefox, Set#entries/keys/values & Map#clear do not exist
- https://bugzilla.mozilla.org/show_bug.cgi?id=869996
- In Firefox 24, Map and Set do not implement forEach
- In Firefox 25 at least, Map and Set are callable without "new"
*/
if (
typeof globals.Map.prototype.clear !== 'function' ||
new globals.Set().size !== 0 ||
new globals.Map().size !== 0 ||
typeof globals.Map.prototype.keys !== 'function' ||
typeof globals.Set.prototype.keys !== 'function' ||
typeof globals.Map.prototype.forEach !== 'function' ||
typeof globals.Set.prototype.forEach !== 'function' ||
isCallableWithoutNew(globals.Map) ||
isCallableWithoutNew(globals.Set) ||
typeof (new globals.Map().keys().next) !== 'function' || // Safari 8
mapIterationThrowsStopIterator || // Firefox 25
!mapSupportsSubclassing
) {
defineProperties(globals, {
Map: collectionShims.Map,
Set: collectionShims.Set
}, true);
}
if (globals.Set.prototype.keys !== globals.Set.prototype.values) {
// Fixed in WebKit with https://bugs.webkit.org/show_bug.cgi?id=144190
defineProperty(globals.Set.prototype, 'keys', globals.Set.prototype.values, true);
}
// Shim incomplete iterator implementations.
addIterator(Object.getPrototypeOf((new globals.Map()).keys()));
addIterator(Object.getPrototypeOf((new globals.Set()).keys()));
if (functionsHaveNames && globals.Set.prototype.has.name !== 'has') {
// Microsoft Edge v0.11.10074.0 is missing a name on Set#has
var anonymousSetHas = globals.Set.prototype.has;
overrideNative(globals.Set.prototype, 'has', function has(key) {
return _call(anonymousSetHas, this, key);
});
}
}
defineProperties(globals, collectionShims);
addDefaultSpecies(globals.Map);
addDefaultSpecies(globals.Set);
}
var throwUnlessTargetIsObject = function throwUnlessTargetIsObject(target) {
if (!ES.TypeIsObject(target)) {
throw new TypeError('target must be an object');
}
};
// Some Reflect methods are basically the same as
// those on the Object global, except that a TypeError is thrown if
// target isn't an object. As well as returning a boolean indicating
// the success of the operation.
var ReflectShims = {
// Apply method in a functional form.
apply: function apply() {
return ES.Call(ES.Call, null, arguments);
},
// New operator in a functional form.
construct: function construct(constructor, args) {
if (!ES.IsConstructor(constructor)) {
throw new TypeError('First argument must be a constructor.');
}
var newTarget = arguments.length > 2 ? arguments[2] : constructor;
if (!ES.IsConstructor(newTarget)) {
throw new TypeError('new.target must be a constructor.');
}
return ES.Construct(constructor, args, newTarget, 'internal');
},
// When deleting a non-existent or configurable property,
// true is returned.
// When attempting to delete a non-configurable property,
// it will return false.
deleteProperty: function deleteProperty(target, key) {
throwUnlessTargetIsObject(target);
if (supportsDescriptors) {
var desc = Object.getOwnPropertyDescriptor(target, key);
if (desc && !desc.configurable) {
return false;
}
}
// Will return true.
return delete target[key];
},
has: function has(target, key) {
throwUnlessTargetIsObject(target);
return key in target;
}
};
if (Object.getOwnPropertyNames) {
Object.assign(ReflectShims, {
// Basically the result of calling the internal [[OwnPropertyKeys]].
// Concatenating propertyNames and propertySymbols should do the trick.
// This should continue to work together with a Symbol shim
// which overrides Object.getOwnPropertyNames and implements
// Object.getOwnPropertySymbols.
ownKeys: function ownKeys(target) {
throwUnlessTargetIsObject(target);
var keys = Object.getOwnPropertyNames(target);
if (ES.IsCallable(Object.getOwnPropertySymbols)) {
_pushApply(keys, Object.getOwnPropertySymbols(target));
}
return keys;
}
});
}
var callAndCatchException = function ConvertExceptionToBoolean(func) {
return !throwsError(func);
};
if (Object.preventExtensions) {
Object.assign(ReflectShims, {
isExtensible: function isExtensible(target) {
throwUnlessTargetIsObject(target);
return Object.isExtensible(target);
},
preventExtensions: function preventExtensions(target) {
throwUnlessTargetIsObject(target);
return callAndCatchException(function () {
Object.preventExtensions(target);
});
}
});
}
if (supportsDescriptors) {
var internalGet = function get(target, key, receiver) {
var desc = Object.getOwnPropertyDescriptor(target, key);
if (!desc) {
var parent = Object.getPrototypeOf(target);
if (parent === null) {
return void 0;
}
return internalGet(parent, key, receiver);
}
if ('value' in desc) {
return desc.value;
}
if (desc.get) {
return ES.Call(desc.get, receiver);
}
return void 0;
};
var internalSet = function set(target, key, value, receiver) {
var desc = Object.getOwnPropertyDescriptor(target, key);
if (!desc) {
var parent = Object.getPrototypeOf(target);
if (parent !== null) {
return internalSet(parent, key, value, receiver);
}
desc = {
value: void 0,
writable: true,
enumerable: true,
configurable: true
};
}
if ('value' in desc) {
if (!desc.writable) {
return false;
}
if (!ES.TypeIsObject(receiver)) {
return false;
}
var existingDesc = Object.getOwnPropertyDescriptor(receiver, key);
if (existingDesc) {
return Reflect.defineProperty(receiver, key, {
value: value
});
} else {
return Reflect.defineProperty(receiver, key, {
value: value,
writable: true,
enumerable: true,
configurable: true
});
}
}
if (desc.set) {
_call(desc.set, receiver, value);
return true;
}
return false;
};
Object.assign(ReflectShims, {
defineProperty: function defineProperty(target, propertyKey, attributes) {
throwUnlessTargetIsObject(target);
return callAndCatchException(function () {
Object.defineProperty(target, propertyKey, attributes);
});
},
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) {
throwUnlessTargetIsObject(target);
return Object.getOwnPropertyDescriptor(target, propertyKey);
},
// Syntax in a functional form.
get: function get(target, key) {
throwUnlessTargetIsObject(target);
var receiver = arguments.length > 2 ? arguments[2] : target;
return internalGet(target, key, receiver);
},
set: function set(target, key, value) {
throwUnlessTargetIsObject(target);
var receiver = arguments.length > 3 ? arguments[3] : target;
return internalSet(target, key, value, receiver);
}
});
}
if (Object.getPrototypeOf) {
var objectDotGetPrototypeOf = Object.getPrototypeOf;
ReflectShims.getPrototypeOf = function getPrototypeOf(target) {
throwUnlessTargetIsObject(target);
return objectDotGetPrototypeOf(target);
};
}
if (Object.setPrototypeOf && ReflectShims.getPrototypeOf) {
var willCreateCircularPrototype = function (object, lastProto) {
var proto = lastProto;
while (proto) {
if (object === proto) {
return true;
}
proto = ReflectShims.getPrototypeOf(proto);
}
return false;
};
Object.assign(ReflectShims, {
// Sets the prototype of the given object.
// Returns true on success, otherwise false.
setPrototypeOf: function setPrototypeOf(object, proto) {
throwUnlessTargetIsObject(object);
if (proto !== null && !ES.TypeIsObject(proto)) {
throw new TypeError('proto must be an object or null');
}
// If they already are the same, we're done.
if (proto === Reflect.getPrototypeOf(object)) {
return true;
}
// Cannot alter prototype if object not extensible.
if (Reflect.isExtensible && !Reflect.isExtensible(object)) {
return false;
}
// Ensure that we do not create a circular prototype chain.
if (willCreateCircularPrototype(object, proto)) {
return false;
}
Object.setPrototypeOf(object, proto);
return true;
}
});
}
var defineOrOverrideReflectProperty = function (key, shim) {
if (!ES.IsCallable(globals.Reflect[key])) {
defineProperty(globals.Reflect, key, shim);
} else {
var acceptsPrimitives = valueOrFalseIfThrows(function () {
globals.Reflect[key](1);
globals.Reflect[key](NaN);
globals.Reflect[key](true);
return true;
});
if (acceptsPrimitives) {
overrideNative(globals.Reflect, key, shim);
}
}
};
Object.keys(ReflectShims).forEach(function (key) {
defineOrOverrideReflectProperty(key, ReflectShims[key]);
});
var originalReflectGetProto = globals.Reflect.getPrototypeOf;
if (functionsHaveNames && originalReflectGetProto && originalReflectGetProto.name !== 'getPrototypeOf') {
overrideNative(globals.Reflect, 'getPrototypeOf', function getPrototypeOf(target) {
return _call(originalReflectGetProto, globals.Reflect, target);
});
}
if (globals.Reflect.setPrototypeOf) {
if (valueOrFalseIfThrows(function () {
globals.Reflect.setPrototypeOf(1, {});
return true;
})) {
overrideNative(globals.Reflect, 'setPrototypeOf', ReflectShims.setPrototypeOf);
}
}
if (globals.Reflect.defineProperty) {
if (!valueOrFalseIfThrows(function () {
var basic = !globals.Reflect.defineProperty(1, 'test', { value: 1 });
// "extensible" fails on Edge 0.12
var extensible = typeof Object.preventExtensions !== 'function' || !globals.Reflect.defineProperty(Object.preventExtensions({}), 'test', {});
return basic && extensible;
})) {
overrideNative(globals.Reflect, 'defineProperty', ReflectShims.defineProperty);
}
}
if (globals.Reflect.construct) {
if (!valueOrFalseIfThrows(function () {
var F = function F() {};
return globals.Reflect.construct(function () {}, [], F) instanceof F;
})) {
overrideNative(globals.Reflect, 'construct', ReflectShims.construct);
}
}
if (String(new Date(NaN)) !== 'Invalid Date') {
var dateToString = Date.prototype.toString;
var shimmedDateToString = function toString() {
var valueOf = +this;
if (valueOf !== valueOf) {
return 'Invalid Date';
}
return ES.Call(dateToString, this);
};
overrideNative(Date.prototype, 'toString', shimmedDateToString);
}
// Annex B HTML methods
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-string.prototype-object
var stringHTMLshims = {
anchor: function anchor(name) { return ES.CreateHTML(this, 'a', 'name', name); },
big: function big() { return ES.CreateHTML(this, 'big', '', ''); },
blink: function blink() { return ES.CreateHTML(this, 'blink', '', ''); },
bold: function bold() { return ES.CreateHTML(this, 'b', '', ''); },
fixed: function fixed() { return ES.CreateHTML(this, 'tt', '', ''); },
fontcolor: function fontcolor(color) { return ES.CreateHTML(this, 'font', 'color', color); },
fontsize: function fontsize(size) { return ES.CreateHTML(this, 'font', 'size', size); },
italics: function italics() { return ES.CreateHTML(this, 'i', '', ''); },
link: function link(url) { return ES.CreateHTML(this, 'a', 'href', url); },
small: function small() { return ES.CreateHTML(this, 'small', '', ''); },
strike: function strike() { return ES.CreateHTML(this, 'strike', '', ''); },
sub: function sub() { return ES.CreateHTML(this, 'sub', '', ''); },
sup: function sub() { return ES.CreateHTML(this, 'sup', '', ''); }
};
_forEach(Object.keys(stringHTMLshims), function (key) {
var method = String.prototype[key];
var shouldOverwrite = false;
if (ES.IsCallable(method)) {
var output = _call(method, '', ' " ');
var quotesCount = _concat([], output.match(/"/g)).length;
shouldOverwrite = output !== output.toLowerCase() || quotesCount > 2;
} else {
shouldOverwrite = true;
}
if (shouldOverwrite) {
overrideNative(String.prototype, key, stringHTMLshims[key]);
}
});
var JSONstringifiesSymbols = (function () {
// Microsoft Edge v0.12 stringifies Symbols incorrectly
if (!hasSymbols) { return false; } // Symbols are not supported
var stringify = typeof JSON === 'object' && typeof JSON.stringify === 'function' ? JSON.stringify : null;
if (!stringify) { return false; } // JSON.stringify is not supported
if (typeof stringify(Symbol()) !== 'undefined') { return true; } // Symbols should become `undefined`
if (stringify([Symbol()]) !== '[null]') { return true; } // Symbols in arrays should become `null`
var obj = { a: Symbol() };
obj[Symbol()] = true;
if (stringify(obj) !== '{}') { return true; } // Symbol-valued keys *and* Symbol-valued properties should be omitted
return false;
}());
var JSONstringifyAcceptsObjectSymbol = valueOrFalseIfThrows(function () {
// Chrome 45 throws on stringifying object symbols
if (!hasSymbols) { return true; } // Symbols are not supported
return JSON.stringify(Object(Symbol())) === '{}' && JSON.stringify([Object(Symbol())]) === '[{}]';
});
if (JSONstringifiesSymbols || !JSONstringifyAcceptsObjectSymbol) {
var origStringify = JSON.stringify;
overrideNative(JSON, 'stringify', function stringify(value) {
if (typeof value === 'symbol') { return; }
var replacer;
if (arguments.length > 1) {
replacer = arguments[1];
}
var args = [value];
if (!isArray(replacer)) {
var replaceFn = ES.IsCallable(replacer) ? replacer : null;
var wrappedReplacer = function (key, val) {
var parsedValue = replaceFn ? _call(replaceFn, this, key, val) : val;
if (typeof parsedValue !== 'symbol') {
if (Type.symbol(parsedValue)) {
return assignTo({})(parsedValue);
} else {
return parsedValue;
}
}
};
args.push(wrappedReplacer);
} else {
// create wrapped replacer that handles an array replacer?
args.push(replacer);
}
if (arguments.length > 2) {
args.push(arguments[2]);
}
return origStringify.apply(this, args);
});
}
return globals;
}));
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(133)))
/***/ },
/* 425 */,
/* 426 */,
/* 427 */,
/* 428 */,
/* 429 */,
/* 430 */,
/* 431 */,
/* 432 */,
/* 433 */,
/* 434 */,
/* 435 */,
/* 436 */,
/* 437 */,
/* 438 */,
/* 439 */,
/* 440 */,
/* 441 */,
/* 442 */,
/* 443 */
/***/ function(module, exports) {
/*! *****************************************************************************
Copyright (C) Microsoft. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
"use strict";
var Reflect;
(function (Reflect) {
// Load global or shim versions of Map, Set, and WeakMap
var functionPrototype = Object.getPrototypeOf(Function);
var _Map = typeof Map === "function" ? Map : CreateMapPolyfill();
var _Set = typeof Set === "function" ? Set : CreateSetPolyfill();
var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
// [[Metadata]] internal slot
var __Metadata__ = new _WeakMap();
/**
* Applies a set of decorators to a property of a target object.
* @param decorators An array of decorators.
* @param target The target object.
* @param targetKey (Optional) The property key to decorate.
* @param targetDescriptor (Optional) The property descriptor for the target key
* @remarks Decorators are applied in reverse order.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* C = Reflect.decorate(decoratorsArray, C);
*
* // property (on constructor)
* Reflect.decorate(decoratorsArray, C, "staticProperty");
*
* // property (on prototype)
* Reflect.decorate(decoratorsArray, C.prototype, "property");
*
* // method (on constructor)
* Object.defineProperty(C, "staticMethod",
* Reflect.decorate(decoratorsArray, C, "staticMethod",
* Object.getOwnPropertyDescriptor(C, "staticMethod")));
*
* // method (on prototype)
* Object.defineProperty(C.prototype, "method",
* Reflect.decorate(decoratorsArray, C.prototype, "method",
* Object.getOwnPropertyDescriptor(C.prototype, "method")));
*
*/
function decorate(decorators, target, targetKey, targetDescriptor) {
if (!IsUndefined(targetDescriptor)) {
if (!IsArray(decorators)) {
throw new TypeError();
}
else if (!IsObject(target)) {
throw new TypeError();
}
else if (IsUndefined(targetKey)) {
throw new TypeError();
}
else if (!IsObject(targetDescriptor)) {
throw new TypeError();
}
targetKey = ToPropertyKey(targetKey);
return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor);
}
else if (!IsUndefined(targetKey)) {
if (!IsArray(decorators)) {
throw new TypeError();
}
else if (!IsObject(target)) {
throw new TypeError();
}
targetKey = ToPropertyKey(targetKey);
return DecoratePropertyWithoutDescriptor(decorators, target, targetKey);
}
else {
if (!IsArray(decorators)) {
throw new TypeError();
}
else if (!IsConstructor(target)) {
throw new TypeError();
}
return DecorateConstructor(decorators, target);
}
}
Reflect.decorate = decorate;
/**
* A default metadata decorator factory that can be used on a class, class member, or parameter.
* @param metadataKey The key for the metadata entry.
* @param metadataValue The value for the metadata entry.
* @returns A decorator function.
* @remarks
* If `metadataKey` is already defined for the target and target key, the
* metadataValue for that key will be overwritten.
* @example
*
* // constructor
* @Reflect.metadata(key, value)
* class C {
* }
*
* // property (on constructor, TypeScript only)
* class C {
* @Reflect.metadata(key, value)
* static staticProperty;
* }
*
* // property (on prototype, TypeScript only)
* class C {
* @Reflect.metadata(key, value)
* property;
* }
*
* // method (on constructor)
* class C {
* @Reflect.metadata(key, value)
* static staticMethod() { }
* }
*
* // method (on prototype)
* class C {
* @Reflect.metadata(key, value)
* method() { }
* }
*
*/
function metadata(metadataKey, metadataValue) {
function decorator(target, targetKey) {
if (!IsUndefined(targetKey)) {
if (!IsObject(target)) {
throw new TypeError();
}
targetKey = ToPropertyKey(targetKey);
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
}
else {
if (!IsConstructor(target)) {
throw new TypeError();
}
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined);
}
}
return decorator;
}
Reflect.metadata = metadata;
/**
* Define a unique metadata entry on the target.
* @param metadataKey A key used to store and retrieve metadata.
* @param metadataValue A value that contains attached metadata.
* @param target The target object on which to define metadata.
* @param targetKey (Optional) The property key for the target.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* Reflect.defineMetadata("custom:annotation", options, C);
*
* // property (on constructor)
* Reflect.defineMetadata("custom:annotation", options, C, "staticProperty");
*
* // property (on prototype)
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "property");
*
* // method (on constructor)
* Reflect.defineMetadata("custom:annotation", options, C, "staticMethod");
*
* // method (on prototype)
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "method");
*
* // decorator factory as metadata-producing annotation.
* function MyAnnotation(options): Decorator {
* return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key);
* }
*
*/
function defineMetadata(metadataKey, metadataValue, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
}
Reflect.defineMetadata = defineMetadata;
/**
* Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
* @param metadataKey A key used to store and retrieve metadata.
* @param target The target object on which the metadata is defined.
* @param targetKey (Optional) The property key for the target.
* @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* result = Reflect.hasMetadata("custom:annotation", C);
*
* // property (on constructor)
* result = Reflect.hasMetadata("custom:annotation", C, "staticProperty");
*
* // property (on prototype)
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "property");
*
* // method (on constructor)
* result = Reflect.hasMetadata("custom:annotation", C, "staticMethod");
*
* // method (on prototype)
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "method");
*
*/
function hasMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryHasMetadata(metadataKey, target, targetKey);
}
Reflect.hasMetadata = hasMetadata;
/**
* Gets a value indicating whether the target object has the provided metadata key defined.
* @param metadataKey A key used to store and retrieve metadata.
* @param target The target object on which the metadata is defined.
* @param targetKey (Optional) The property key for the target.
* @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* result = Reflect.hasOwnMetadata("custom:annotation", C);
*
* // property (on constructor)
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty");
*
* // property (on prototype)
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property");
*
* // method (on constructor)
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod");
*
* // method (on prototype)
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method");
*
*/
function hasOwnMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryHasOwnMetadata(metadataKey, target, targetKey);
}
Reflect.hasOwnMetadata = hasOwnMetadata;
/**
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
* @param metadataKey A key used to store and retrieve metadata.
* @param target The target object on which the metadata is defined.
* @param targetKey (Optional) The property key for the target.
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* result = Reflect.getMetadata("custom:annotation", C);
*
* // property (on constructor)
* result = Reflect.getMetadata("custom:annotation", C, "staticProperty");
*
* // property (on prototype)
* result = Reflect.getMetadata("custom:annotation", C.prototype, "property");
*
* // method (on constructor)
* result = Reflect.getMetadata("custom:annotation", C, "staticMethod");
*
* // method (on prototype)
* result = Reflect.getMetadata("custom:annotation", C.prototype, "method");
*
*/
function getMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryGetMetadata(metadataKey, target, targetKey);
}
Reflect.getMetadata = getMetadata;
/**
* Gets the metadata value for the provided metadata key on the target object.
* @param metadataKey A key used to store and retrieve metadata.
* @param target The target object on which the metadata is defined.
* @param targetKey (Optional) The property key for the target.
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* result = Reflect.getOwnMetadata("custom:annotation", C);
*
* // property (on constructor)
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty");
*
* // property (on prototype)
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property");
*
* // method (on constructor)
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod");
*
* // method (on prototype)
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method");
*
*/
function getOwnMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryGetOwnMetadata(metadataKey, target, targetKey);
}
Reflect.getOwnMetadata = getOwnMetadata;
/**
* Gets the metadata keys defined on the target object or its prototype chain.
* @param target The target object on which the metadata is defined.
* @param targetKey (Optional) The property key for the target.
* @returns An array of unique metadata keys.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* result = Reflect.getMetadataKeys(C);
*
* // property (on constructor)
* result = Reflect.getMetadataKeys(C, "staticProperty");
*
* // property (on prototype)
* result = Reflect.getMetadataKeys(C.prototype, "property");
*
* // method (on constructor)
* result = Reflect.getMetadataKeys(C, "staticMethod");
*
* // method (on prototype)
* result = Reflect.getMetadataKeys(C.prototype, "method");
*
*/
function getMetadataKeys(target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryMetadataKeys(target, targetKey);
}
Reflect.getMetadataKeys = getMetadataKeys;
/**
* Gets the unique metadata keys defined on the target object.
* @param target The target object on which the metadata is defined.
* @param targetKey (Optional) The property key for the target.
* @returns An array of unique metadata keys.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* result = Reflect.getOwnMetadataKeys(C);
*
* // property (on constructor)
* result = Reflect.getOwnMetadataKeys(C, "staticProperty");
*
* // property (on prototype)
* result = Reflect.getOwnMetadataKeys(C.prototype, "property");
*
* // method (on constructor)
* result = Reflect.getOwnMetadataKeys(C, "staticMethod");
*
* // method (on prototype)
* result = Reflect.getOwnMetadataKeys(C.prototype, "method");
*
*/
function getOwnMetadataKeys(target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryOwnMetadataKeys(target, targetKey);
}
Reflect.getOwnMetadataKeys = getOwnMetadataKeys;
/**
* Deletes the metadata entry from the target object with the provided key.
* @param metadataKey A key used to store and retrieve metadata.
* @param target The target object on which the metadata is defined.
* @param targetKey (Optional) The property key for the target.
* @returns `true` if the metadata entry was found and deleted; otherwise, false.
* @example
*
* class C {
* // property declarations are not part of ES6, though they are valid in TypeScript:
* // static staticProperty;
* // property;
*
* constructor(p) { }
* static staticMethod(p) { }
* method(p) { }
* }
*
* // constructor
* result = Reflect.deleteMetadata("custom:annotation", C);
*
* // property (on constructor)
* result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty");
*
* // property (on prototype)
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property");
*
* // method (on constructor)
* result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod");
*
* // method (on prototype)
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method");
*
*/
function deleteMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
}
else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p-
var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
if (IsUndefined(metadataMap)) {
return false;
}
if (!metadataMap.delete(metadataKey)) {
return false;
}
if (metadataMap.size > 0) {
return true;
}
var targetMetadata = __Metadata__.get(target);
targetMetadata.delete(targetKey);
if (targetMetadata.size > 0) {
return true;
}
__Metadata__.delete(target);
return true;
}
Reflect.deleteMetadata = deleteMetadata;
function DecorateConstructor(decorators, target) {
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
var decorated = decorator(target);
if (!IsUndefined(decorated)) {
if (!IsConstructor(decorated)) {
throw new TypeError();
}
target = decorated;
}
}
return target;
}
function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) {
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
var decorated = decorator(target, propertyKey, descriptor);
if (!IsUndefined(decorated)) {
if (!IsObject(decorated)) {
throw new TypeError();
}
descriptor = decorated;
}
}
return descriptor;
}
function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) {
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
decorator(target, propertyKey);
}
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create-
function GetOrCreateMetadataMap(target, targetKey, create) {
var targetMetadata = __Metadata__.get(target);
if (!targetMetadata) {
if (!create) {
return undefined;
}
targetMetadata = new _Map();
__Metadata__.set(target, targetMetadata);
}
var keyMetadata = targetMetadata.get(targetKey);
if (!keyMetadata) {
if (!create) {
return undefined;
}
keyMetadata = new _Map();
targetMetadata.set(targetKey, keyMetadata);
}
return keyMetadata;
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p-
function OrdinaryHasMetadata(MetadataKey, O, P) {
var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
if (hasOwn) {
return true;
}
var parent = GetPrototypeOf(O);
if (parent !== null) {
return OrdinaryHasMetadata(MetadataKey, parent, P);
}
return false;
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p-
function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
var metadataMap = GetOrCreateMetadataMap(O, P, false);
if (metadataMap === undefined) {
return false;
}
return Boolean(metadataMap.has(MetadataKey));
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p-
function OrdinaryGetMetadata(MetadataKey, O, P) {
var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
if (hasOwn) {
return OrdinaryGetOwnMetadata(MetadataKey, O, P);
}
var parent = GetPrototypeOf(O);
if (parent !== null) {
return OrdinaryGetMetadata(MetadataKey, parent, P);
}
return undefined;
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p-
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
var metadataMap = GetOrCreateMetadataMap(O, P, false);
if (metadataMap === undefined) {
return undefined;
}
return metadataMap.get(MetadataKey);
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p-
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
var metadataMap = GetOrCreateMetadataMap(O, P, true);
metadataMap.set(MetadataKey, MetadataValue);
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p-
function OrdinaryMetadataKeys(O, P) {
var ownKeys = OrdinaryOwnMetadataKeys(O, P);
var parent = GetPrototypeOf(O);
if (parent === null) {
return ownKeys;
}
var parentKeys = OrdinaryMetadataKeys(parent, P);
if (parentKeys.length <= 0) {
return ownKeys;
}
if (ownKeys.length <= 0) {
return parentKeys;
}
var set = new _Set();
var keys = [];
for (var _i = 0; _i < ownKeys.length; _i++) {
var key = ownKeys[_i];
var hasKey = set.has(key);
if (!hasKey) {
set.add(key);
keys.push(key);
}
}
for (var _a = 0; _a < parentKeys.length; _a++) {
var key = parentKeys[_a];
var hasKey = set.has(key);
if (!hasKey) {
set.add(key);
keys.push(key);
}
}
return keys;
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p-
function OrdinaryOwnMetadataKeys(target, targetKey) {
var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
var keys = [];
if (metadataMap) {
metadataMap.forEach(function (_, key) { return keys.push(key); });
}
return keys;
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type
function IsUndefined(x) {
return x === undefined;
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray
function IsArray(x) {
return Array.isArray(x);
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type
function IsObject(x) {
return typeof x === "object" ? x !== null : typeof x === "function";
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor
function IsConstructor(x) {
return typeof x === "function";
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type
function IsSymbol(x) {
return typeof x === "symbol";
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey
function ToPropertyKey(value) {
if (IsSymbol(value)) {
return value;
}
return String(value);
}
function GetPrototypeOf(O) {
var proto = Object.getPrototypeOf(O);
if (typeof O !== "function" || O === functionPrototype) {
return proto;
}
// TypeScript doesn't set __proto__ in ES5, as it's non-standard.
// Try to determine the superclass constructor. Compatible implementations
// must either set __proto__ on a subclass constructor to the superclass constructor,
// or ensure each class has a valid `constructor` property on its prototype that
// points back to the constructor.
// If this is not the same as Function.[[Prototype]], then this is definately inherited.
// This is the case when in ES6 or when using __proto__ in a compatible browser.
if (proto !== functionPrototype) {
return proto;
}
// If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.
var prototype = O.prototype;
var prototypeProto = Object.getPrototypeOf(prototype);
if (prototypeProto == null || prototypeProto === Object.prototype) {
return proto;
}
// if the constructor was not a function, then we cannot determine the heritage.
var constructor = prototypeProto.constructor;
if (typeof constructor !== "function") {
return proto;
}
// if we have some kind of self-reference, then we cannot determine the heritage.
if (constructor === O) {
return proto;
}
// we have a pretty good guess at the heritage.
return constructor;
}
// naive Map shim
function CreateMapPolyfill() {
var cacheSentinel = {};
function Map() {
this._keys = [];
this._values = [];
this._cache = cacheSentinel;
}
Map.prototype = {
get size() {
return this._keys.length;
},
has: function (key) {
if (key === this._cache) {
return true;
}
if (this._find(key) >= 0) {
this._cache = key;
return true;
}
return false;
},
get: function (key) {
var index = this._find(key);
if (index >= 0) {
this._cache = key;
return this._values[index];
}
return undefined;
},
set: function (key, value) {
this.delete(key);
this._keys.push(key);
this._values.push(value);
this._cache = key;
return this;
},
delete: function (key) {
var index = this._find(key);
if (index >= 0) {
this._keys.splice(index, 1);
this._values.splice(index, 1);
this._cache = cacheSentinel;
return true;
}
return false;
},
clear: function () {
this._keys.length = 0;
this._values.length = 0;
this._cache = cacheSentinel;
},
forEach: function (callback, thisArg) {
var size = this.size;
for (var i = 0; i < size; ++i) {
var key = this._keys[i];
var value = this._values[i];
this._cache = key;
callback.call(this, value, key, this);
}
},
_find: function (key) {
var keys = this._keys;
var size = keys.length;
for (var i = 0; i < size; ++i) {
if (keys[i] === key) {
return i;
}
}
return -1;
}
};
return Map;
}
// naive Set shim
function CreateSetPolyfill() {
var cacheSentinel = {};
function Set() {
this._map = new _Map();
}
Set.prototype = {
get size() {
return this._map.length;
},
has: function (value) {
return this._map.has(value);
},
add: function (value) {
this._map.set(value, value);
return this;
},
delete: function (value) {
return this._map.delete(value);
},
clear: function () {
this._map.clear();
},
forEach: function (callback, thisArg) {
this._map.forEach(callback, thisArg);
}
};
return Set;
}
// naive WeakMap shim
function CreateWeakMapPolyfill() {
var UUID_SIZE = 16;
var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]';
var nodeCrypto = isNode && require("crypto");
var hasOwn = Object.prototype.hasOwnProperty;
var keys = {};
var rootKey = CreateUniqueKey();
function WeakMap() {
this._key = CreateUniqueKey();
}
WeakMap.prototype = {
has: function (target) {
var table = GetOrCreateWeakMapTable(target, false);
if (table) {
return this._key in table;
}
return false;
},
get: function (target) {
var table = GetOrCreateWeakMapTable(target, false);
if (table) {
return table[this._key];
}
return undefined;
},
set: function (target, value) {
var table = GetOrCreateWeakMapTable(target, true);
table[this._key] = value;
return this;
},
delete: function (target) {
var table = GetOrCreateWeakMapTable(target, false);
if (table && this._key in table) {
return delete table[this._key];
}
return false;
},
clear: function () {
// NOTE: not a real clear, just makes the previous data unreachable
this._key = CreateUniqueKey();
}
};
function FillRandomBytes(buffer, size) {
for (var i = 0; i < size; ++i) {
buffer[i] = Math.random() * 255 | 0;
}
}
function GenRandomBytes(size) {
if (nodeCrypto) {
var data = nodeCrypto.randomBytes(size);
return data;
}
else if (typeof Uint8Array === "function") {
var data = new Uint8Array(size);
if (typeof crypto !== "undefined") {
crypto.getRandomValues(data);
}
else if (typeof msCrypto !== "undefined") {
msCrypto.getRandomValues(data);
}
else {
FillRandomBytes(data, size);
}
return data;
}
else {
var data = new Array(size);
FillRandomBytes(data, size);
return data;
}
}
function CreateUUID() {
var data = GenRandomBytes(UUID_SIZE);
// mark as random - RFC 4122 § 4.4
data[6] = data[6] & 0x4f | 0x40;
data[8] = data[8] & 0xbf | 0x80;
var result = "";
for (var offset = 0; offset < UUID_SIZE; ++offset) {
var byte = data[offset];
if (offset === 4 || offset === 6 || offset === 8) {
result += "-";
}
if (byte < 16) {
result += "0";
}
result += byte.toString(16).toLowerCase();
}
return result;
}
function CreateUniqueKey() {
var key;
do {
key = "@@WeakMap@@" + CreateUUID();
} while (hasOwn.call(keys, key));
keys[key] = true;
return key;
}
function GetOrCreateWeakMapTable(target, create) {
if (!hasOwn.call(target, rootKey)) {
if (!create) {
return undefined;
}
Object.defineProperty(target, rootKey, { value: Object.create(null) });
}
return target[rootKey];
}
return WeakMap;
}
// hook global Reflect
(function (__global) {
if (typeof __global.Reflect !== "undefined") {
if (__global.Reflect !== Reflect) {
for (var p in Reflect) {
__global.Reflect[p] = Reflect[p];
}
}
}
else {
__global.Reflect = Reflect;
}
})(typeof window !== "undefined" ? window :
typeof WorkerGlobalScope !== "undefined" ? self :
typeof global !== "undefined" ? global :
Function("return this;")());
})(Reflect || (Reflect = {}));
//# sourceMappingURL=Reflect.js.map
/***/ },
/* 444 */
/***/ function(module, exports) {
"use strict";
exports.empty = {
isUnsubscribed: true,
next: function (value) { },
error: function (err) { throw err; },
complete: function () { }
};
//# sourceMappingURL=Observer.js.map
/***/ },
/* 445 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscription_1 = __webpack_require__(134);
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var SubjectSubscription = (function (_super) {
__extends(SubjectSubscription, _super);
function SubjectSubscription(subject, observer) {
_super.call(this);
this.subject = subject;
this.observer = observer;
this.isUnsubscribed = false;
}
SubjectSubscription.prototype.unsubscribe = function () {
if (this.isUnsubscribed) {
return;
}
this.isUnsubscribed = true;
var subject = this.subject;
var observers = subject.observers;
this.subject = null;
if (!observers || observers.length === 0 || subject.isUnsubscribed) {
return;
}
var subscriberIndex = observers.indexOf(this.observer);
if (subscriberIndex !== -1) {
observers.splice(subscriberIndex, 1);
}
};
return SubjectSubscription;
}(Subscription_1.Subscription));
exports.SubjectSubscription = SubjectSubscription;
//# sourceMappingURL=SubjectSubscription.js.map
/***/ },
/* 446 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var root_1 = __webpack_require__(43);
var Symbol = root_1.root.Symbol;
if (typeof Symbol === 'function') {
if (Symbol.observable) {
exports.$$observable = Symbol.observable;
}
else {
if (typeof Symbol.for === 'function') {
exports.$$observable = Symbol.for('observable');
}
else {
exports.$$observable = Symbol('observable');
}
Symbol.observable = exports.$$observable;
}
}
else {
exports.$$observable = '@@observable';
}
//# sourceMappingURL=observable.js.map
/***/ },
/* 447 */
/***/ function(module, exports) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* An error thrown when an action is invalid because the object has been
* unsubscribed.
*
* @see {@link Subject}
* @see {@link BehaviorSubject}
*
* @class ObjectUnsubscribedError
*/
var ObjectUnsubscribedError = (function (_super) {
__extends(ObjectUnsubscribedError, _super);
function ObjectUnsubscribedError() {
_super.call(this, 'object unsubscribed');
this.name = 'ObjectUnsubscribedError';
}
return ObjectUnsubscribedError;
}(Error));
exports.ObjectUnsubscribedError = ObjectUnsubscribedError;
//# sourceMappingURL=ObjectUnsubscribedError.js.map
/***/ },
/* 448 */
/***/ function(module, exports) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* An error thrown when one or more errors have occurred during the
* `unsubscribe` of a {@link Subscription}.
*/
var UnsubscriptionError = (function (_super) {
__extends(UnsubscriptionError, _super);
function UnsubscriptionError(errors) {
_super.call(this);
this.errors = errors;
this.name = 'UnsubscriptionError';
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n') : '';
}
return UnsubscriptionError;
}(Error));
exports.UnsubscriptionError = UnsubscriptionError;
//# sourceMappingURL=UnsubscriptionError.js.map
/***/ },
/* 449 */
/***/ function(module, exports) {
"use strict";
exports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });
//# sourceMappingURL=isArray.js.map
/***/ },
/* 450 */
/***/ function(module, exports) {
"use strict";
function isObject(x) {
return x != null && typeof x === 'object';
}
exports.isObject = isObject;
//# sourceMappingURL=isObject.js.map
/***/ },
/* 451 */
/***/ function(module, exports) {
"use strict";
function throwError(e) { throw e; }
exports.throwError = throwError;
//# sourceMappingURL=throwError.js.map
/***/ },
/* 452 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var Subscriber_1 = __webpack_require__(343);
var rxSubscriber_1 = __webpack_require__(137);
function toSubscriber(nextOrObserver, error, complete) {
if (nextOrObserver && typeof nextOrObserver === 'object') {
if (nextOrObserver instanceof Subscriber_1.Subscriber) {
return nextOrObserver;
}
else if (typeof nextOrObserver[rxSubscriber_1.$$rxSubscriber] === 'function') {
return nextOrObserver[rxSubscriber_1.$$rxSubscriber]();
}
}
return new Subscriber_1.Subscriber(nextOrObserver, error, complete);
}
exports.toSubscriber = toSubscriber;
//# sourceMappingURL=toSubscriber.js.map
/***/ },
/* 453 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var errorObject_1 = __webpack_require__(344);
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
}
catch (e) {
errorObject_1.errorObject.e = e;
return errorObject_1.errorObject;
}
}
function tryCatch(fn) {
tryCatchTarget = fn;
return tryCatcher;
}
exports.tryCatch = tryCatch;
;
//# sourceMappingURL=tryCatch.js.map
/***/ },
/* 454 */,
/* 455 */,
/* 456 */
/***/ function(module, exports) {
module.exports = function() { throw new Error("define cannot be used indirect"); };
/***/ },
/* 457 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {"use strict";
__webpack_require__(1);
var event_target_1 = __webpack_require__(2);
var define_property_1 = __webpack_require__(4);
var register_element_1 = __webpack_require__(5);
var property_descriptor_1 = __webpack_require__(6);
var timers_1 = __webpack_require__(8);
var utils_1 = __webpack_require__(3);
var set = 'set';
var clear = 'clear';
var blockingMethods = ['alert', 'prompt', 'confirm'];
var _global = typeof window == 'undefined' ? global : window;
timers_1.patchTimer(_global, set, clear, 'Timeout');
timers_1.patchTimer(_global, set, clear, 'Interval');
timers_1.patchTimer(_global, set, clear, 'Immediate');
timers_1.patchTimer(_global, 'request', 'cancelMacroTask', 'AnimationFrame');
timers_1.patchTimer(_global, 'mozRequest', 'mozCancel', 'AnimationFrame');
timers_1.patchTimer(_global, 'webkitRequest', 'webkitCancel', 'AnimationFrame');
for (var i = 0; i < blockingMethods.length; i++) {
var name = blockingMethods[i];
utils_1.patchMethod(_global, name, function (delegate, symbol, name) {
return function (s, args) {
return Zone.current.run(delegate, _global, args, name);
};
});
}
event_target_1.eventTargetPatch(_global);
property_descriptor_1.propertyDescriptorPatch(_global);
utils_1.patchClass('MutationObserver');
utils_1.patchClass('WebKitMutationObserver');
utils_1.patchClass('FileReader');
define_property_1.propertyPatch();
register_element_1.registerElementPatch(_global);
// Treat XMLHTTPRequest as a macrotask.
patchXHR(_global);
var XHR_TASK = utils_1.zoneSymbol('xhrTask');
function patchXHR(window) {
function findPendingTask(target) {
var pendingTask = target[XHR_TASK];
return pendingTask;
}
function scheduleTask(task) {
var data = task.data;
data.target.addEventListener('readystatechange', function () {
if (data.target.readyState === XMLHttpRequest.DONE) {
if (!data.aborted) {
task.invoke();
}
}
});
var storedTask = data.target[XHR_TASK];
if (!storedTask) {
data.target[XHR_TASK] = task;
}
setNative.apply(data.target, data.args);
return task;
}
function placeholderCallback() {
}
function clearTask(task) {
var data = task.data;
// Note - ideally, we would call data.target.removeEventListener here, but it's too late
// to prevent it from firing. So instead, we store info for the event listener.
data.aborted = true;
return clearNative.apply(data.target, data.args);
}
var setNative = utils_1.patchMethod(window.XMLHttpRequest.prototype, 'send', function () { return function (self, args) {
var zone = Zone.current;
var options = {
target: self,
isPeriodic: false,
delay: null,
args: args,
aborted: false
};
return zone.scheduleMacroTask('XMLHttpRequest.send', placeholderCallback, options, scheduleTask, clearTask);
}; });
var clearNative = utils_1.patchMethod(window.XMLHttpRequest.prototype, 'abort', function (delegate) { return function (self, args) {
var task = findPendingTask(self);
if (task && typeof task.type == 'string') {
// If the XHR has already completed, do nothing.
if (task.cancelFn == null) {
return;
}
task.zone.cancelTask(task);
}
// Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no task to cancel. Do nothing.
}; });
}
/// GEO_LOCATION
if (_global['navigator'] && _global['navigator'].geolocation) {
utils_1.patchPrototype(_global['navigator'].geolocation, [
'getCurrentPosition',
'watchPosition'
]);
}
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 1 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {;
;
var Zone = (function (global) {
var Zone = (function () {
function Zone(parent, zoneSpec) {
this._properties = null;
this._parent = parent;
this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '';
this._properties = zoneSpec && zoneSpec.properties || {};
this._zoneDelegate = new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);
}
Object.defineProperty(Zone, "current", {
get: function () { return _currentZone; },
enumerable: true,
configurable: true
});
;
Object.defineProperty(Zone, "currentTask", {
get: function () { return _currentTask; },
enumerable: true,
configurable: true
});
;
Object.defineProperty(Zone.prototype, "parent", {
get: function () { return this._parent; },
enumerable: true,
configurable: true
});
;
Object.defineProperty(Zone.prototype, "name", {
get: function () { return this._name; },
enumerable: true,
configurable: true
});
;
Zone.prototype.get = function (key) {
var current = this;
while (current) {
if (current._properties.hasOwnProperty(key)) {
return current._properties[key];
}
current = current._parent;
}
};
Zone.prototype.fork = function (zoneSpec) {
if (!zoneSpec)
throw new Error('ZoneSpec required!');
return this._zoneDelegate.fork(this, zoneSpec);
};
Zone.prototype.wrap = function (callback, source) {
if (typeof callback !== 'function') {
throw new Error('Expecting function got: ' + callback);
}
var _callback = this._zoneDelegate.intercept(this, callback, source);
var zone = this;
return function () {
return zone.runGuarded(_callback, this, arguments, source);
};
};
Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
if (applyThis === void 0) { applyThis = null; }
if (applyArgs === void 0) { applyArgs = null; }
if (source === void 0) { source = null; }
var oldZone = _currentZone;
_currentZone = this;
try {
return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
}
finally {
_currentZone = oldZone;
}
};
Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
if (applyThis === void 0) { applyThis = null; }
if (applyArgs === void 0) { applyArgs = null; }
if (source === void 0) { source = null; }
var oldZone = _currentZone;
_currentZone = this;
try {
try {
return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
}
catch (error) {
if (this._zoneDelegate.handleError(this, error)) {
throw error;
}
}
}
finally {
_currentZone = oldZone;
}
};
Zone.prototype.runTask = function (task, applyThis, applyArgs) {
task.runCount++;
if (task.zone != this)
throw new Error('A task can only be run in the zone which created it! (Creation: ' +
task.zone.name + '; Execution: ' + this.name + ')');
var previousTask = _currentTask;
_currentTask = task;
var oldZone = _currentZone;
_currentZone = this;
try {
if (task.type == 'macroTask' && task.data && !task.data.isPeriodic) {
task.cancelFn = null;
}
try {
return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
}
catch (error) {
if (this._zoneDelegate.handleError(this, error)) {
throw error;
}
}
}
finally {
_currentZone = oldZone;
_currentTask = previousTask;
}
};
Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {
return this._zoneDelegate.scheduleTask(this, new ZoneTask('microTask', this, source, callback, data, customSchedule, null));
};
Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {
return this._zoneDelegate.scheduleTask(this, new ZoneTask('macroTask', this, source, callback, data, customSchedule, customCancel));
};
Zone.prototype.scheduleEventTask = function (source, callback, data, customSchedule, customCancel) {
return this._zoneDelegate.scheduleTask(this, new ZoneTask('eventTask', this, source, callback, data, customSchedule, customCancel));
};
Zone.prototype.cancelTask = function (task) {
var value = this._zoneDelegate.cancelTask(this, task);
task.runCount = -1;
task.cancelFn = null;
return value;
};
Zone.__symbol__ = __symbol__;
return Zone;
}());
;
var ZoneDelegate = (function () {
function ZoneDelegate(zone, parentDelegate, zoneSpec) {
this._taskCounts = { microTask: 0, macroTask: 0, eventTask: 0 };
this.zone = zone;
this._parentDelegate = parentDelegate;
this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);
this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);
this._interceptZS = zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);
this._interceptDlgt = zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);
this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);
this._invokeDlgt = zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);
this._handleErrorZS = zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);
this._handleErrorDlgt = zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);
this._scheduleTaskZS = zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
this._scheduleTaskDlgt = zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
this._invokeTaskZS = zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);
this._invokeTaskDlgt = zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);
this._cancelTaskZS = zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);
this._cancelTaskDlgt = zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);
this._hasTaskZS = zoneSpec && (zoneSpec.onHasTask ? zoneSpec : parentDelegate._hasTaskZS);
this._hasTaskDlgt = zoneSpec && (zoneSpec.onHasTask ? parentDelegate : parentDelegate._hasTaskDlgt);
}
ZoneDelegate.prototype.fork = function (targetZone, zoneSpec) {
return this._forkZS
? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec)
: new Zone(targetZone, zoneSpec);
};
ZoneDelegate.prototype.intercept = function (targetZone, callback, source) {
return this._interceptZS
? this._interceptZS.onIntercept(this._interceptDlgt, this.zone, targetZone, callback, source)
: callback;
};
ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
return this._invokeZS
? this._invokeZS.onInvoke(this._invokeDlgt, this.zone, targetZone, callback, applyThis, applyArgs, source)
: callback.apply(applyThis, applyArgs);
};
ZoneDelegate.prototype.handleError = function (targetZone, error) {
return this._handleErrorZS
? this._handleErrorZS.onHandleError(this._handleErrorDlgt, this.zone, targetZone, error)
: true;
};
ZoneDelegate.prototype.scheduleTask = function (targetZone, task) {
try {
if (this._scheduleTaskZS) {
return this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this.zone, targetZone, task);
}
else if (task.scheduleFn) {
task.scheduleFn(task);
}
else if (task.type == 'microTask') {
scheduleMicroTask(task);
}
else {
throw new Error('Task is missing scheduleFn.');
}
return task;
}
finally {
if (targetZone == this.zone) {
this._updateTaskCount(task.type, 1);
}
}
};
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
try {
return this._invokeTaskZS
? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this.zone, targetZone, task, applyThis, applyArgs)
: task.callback.apply(applyThis, applyArgs);
}
finally {
if (targetZone == this.zone && (task.type != 'eventTask') && !(task.data && task.data.isPeriodic)) {
this._updateTaskCount(task.type, -1);
}
}
};
ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
var value;
if (this._cancelTaskZS) {
value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this.zone, targetZone, task);
}
else if (!task.cancelFn) {
throw new Error('Task does not support cancellation, or is already canceled.');
}
else {
value = task.cancelFn(task);
}
if (targetZone == this.zone) {
// this should not be in the finally block, because exceptions assume not canceled.
this._updateTaskCount(task.type, -1);
}
return value;
};
ZoneDelegate.prototype.hasTask = function (targetZone, isEmpty) {
return this._hasTaskZS && this._hasTaskZS.onHasTask(this._hasTaskDlgt, this.zone, targetZone, isEmpty);
};
ZoneDelegate.prototype._updateTaskCount = function (type, count) {
var counts = this._taskCounts;
var prev = counts[type];
var next = counts[type] = prev + count;
if (next < 0) {
throw new Error('More tasks executed then were scheduled.');
}
if (prev == 0 || next == 0) {
var isEmpty = {
microTask: counts.microTask > 0,
macroTask: counts.macroTask > 0,
eventTask: counts.eventTask > 0,
change: type
};
try {
this.hasTask(this.zone, isEmpty);
}
finally {
if (this._parentDelegate) {
this._parentDelegate._updateTaskCount(type, count);
}
}
}
};
return ZoneDelegate;
}());
var ZoneTask = (function () {
function ZoneTask(type, zone, source, callback, options, scheduleFn, cancelFn) {
this.runCount = 0;
this.type = type;
this.zone = zone;
this.source = source;
this.data = options;
this.scheduleFn = scheduleFn;
this.cancelFn = cancelFn;
this.callback = callback;
var self = this;
this.invoke = function () {
try {
return zone.runTask(self, this, arguments);
}
finally {
drainMicroTaskQueue();
}
};
}
return ZoneTask;
}());
function __symbol__(name) { return '__zone_symbol__' + name; }
;
var symbolSetTimeout = __symbol__('setTimeout');
var symbolPromise = __symbol__('Promise');
var symbolThen = __symbol__('then');
var _currentZone = new Zone(null, null);
var _currentTask = null;
var _microTaskQueue = [];
var _isDrainingMicrotaskQueue = false;
var _uncaughtPromiseErrors = [];
var _drainScheduled = false;
function scheduleQueueDrain() {
if (!_drainScheduled && !_currentTask && _microTaskQueue.length == 0) {
// We are not running in Task, so we need to kickstart the microtask queue.
if (global[symbolPromise]) {
global[symbolPromise].resolve(0)[symbolThen](drainMicroTaskQueue);
}
else {
global[symbolSetTimeout](drainMicroTaskQueue, 0);
}
}
}
function scheduleMicroTask(task) {
scheduleQueueDrain();
_microTaskQueue.push(task);
}
function consoleError(e) {
var rejection = e && e.rejection;
if (rejection) {
console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection);
}
console.error(e);
}
function drainMicroTaskQueue() {
if (!_isDrainingMicrotaskQueue) {
_isDrainingMicrotaskQueue = true;
while (_microTaskQueue.length) {
var queue = _microTaskQueue;
_microTaskQueue = [];
for (var i = 0; i < queue.length; i++) {
var task = queue[i];
try {
task.zone.runTask(task, null, null);
}
catch (e) {
consoleError(e);
}
}
}
while (_uncaughtPromiseErrors.length) {
var uncaughtPromiseErrors = _uncaughtPromiseErrors;
_uncaughtPromiseErrors = [];
var _loop_1 = function(i) {
var uncaughtPromiseError = uncaughtPromiseErrors[i];
try {
uncaughtPromiseError.zone.runGuarded(function () { throw uncaughtPromiseError; });
}
catch (e) {
consoleError(e);
}
};
for (var i = 0; i < uncaughtPromiseErrors.length; i++) {
_loop_1(i);
}
}
_isDrainingMicrotaskQueue = false;
_drainScheduled = false;
}
}
function isThenable(value) {
return value && value.then;
}
function forwardResolution(value) { return value; }
function forwardRejection(rejection) { return ZoneAwarePromise.reject(rejection); }
var symbolState = __symbol__('state');
var symbolValue = __symbol__('value');
var source = 'Promise.then';
var UNRESOLVED = null;
var RESOLVED = true;
var REJECTED = false;
var REJECTED_NO_CATCH = 0;
function makeResolver(promise, state) {
return function (v) {
resolvePromise(promise, state, v);
// Do not return value or you will break the Promise spec.
};
}
function resolvePromise(promise, state, value) {
if (promise[symbolState] === UNRESOLVED) {
if (value instanceof ZoneAwarePromise && value[symbolState] !== UNRESOLVED) {
clearRejectedNoCatch(value);
resolvePromise(promise, value[symbolState], value[symbolValue]);
}
else if (isThenable(value)) {
value.then(makeResolver(promise, state), makeResolver(promise, false));
}
else {
promise[symbolState] = state;
var queue = promise[symbolValue];
promise[symbolValue] = value;
for (var i = 0; i < queue.length;) {
scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);
}
if (queue.length == 0 && state == REJECTED) {
promise[symbolState] = REJECTED_NO_CATCH;
try {
throw new Error("Uncaught (in promise): " + value);
}
catch (e) {
var error = e;
error.rejection = value;
error.promise = promise;
error.zone = Zone.current;
error.task = Zone.currentTask;
_uncaughtPromiseErrors.push(error);
scheduleQueueDrain();
}
}
}
}
// Resolving an already resolved promise is a noop.
return promise;
}
function clearRejectedNoCatch(promise) {
if (promise[symbolState] === REJECTED_NO_CATCH) {
promise[symbolState] = REJECTED;
for (var i = 0; i < _uncaughtPromiseErrors.length; i++) {
if (promise === _uncaughtPromiseErrors[i].promise) {
_uncaughtPromiseErrors.splice(i, 1);
break;
}
}
}
}
function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {
clearRejectedNoCatch(promise);
var delegate = promise[symbolState] ? onFulfilled || forwardResolution : onRejected || forwardRejection;
zone.scheduleMicroTask(source, function () {
try {
resolvePromise(chainPromise, true, zone.run(delegate, null, [promise[symbolValue]]));
}
catch (error) {
resolvePromise(chainPromise, false, error);
}
});
}
var ZoneAwarePromise = (function () {
function ZoneAwarePromise(executor) {
var promise = this;
promise[symbolState] = UNRESOLVED;
promise[symbolValue] = []; // queue;
try {
executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));
}
catch (e) {
resolvePromise(promise, false, e);
}
}
ZoneAwarePromise.resolve = function (value) {
return resolvePromise(new this(null), RESOLVED, value);
};
ZoneAwarePromise.reject = function (error) {
return resolvePromise(new this(null), REJECTED, error);
};
ZoneAwarePromise.race = function (values) {
var resolve;
var reject;
var promise = new this(function (res, rej) { resolve = res; reject = rej; });
function onResolve(value) { promise && (promise = null || resolve(value)); }
function onReject(error) { promise && (promise = null || reject(error)); }
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
var value = values_1[_i];
if (!isThenable(value)) {
value = this.resolve(value);
}
value.then(onResolve, onReject);
}
return promise;
};
ZoneAwarePromise.all = function (values) {
var resolve;
var reject;
var promise = new this(function (res, rej) { resolve = res; reject = rej; });
var count = 0;
var resolvedValues = [];
function onReject(error) { promise && reject(error); promise = null; }
for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
var value = values_2[_i];
if (!isThenable(value)) {
value = this.resolve(value);
}
value.then((function (index) { return function (value) {
resolvedValues[index] = value;
count--;
if (promise && !count) {
resolve(resolvedValues);
}
promise == null;
}; })(count), onReject);
count++;
}
if (!count)
resolve(resolvedValues);
return promise;
};
ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
var chainPromise = new ZoneAwarePromise(null);
var zone = Zone.current;
if (this[symbolState] == UNRESOLVED) {
this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);
}
else {
scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);
}
return chainPromise;
};
ZoneAwarePromise.prototype.catch = function (onRejected) {
return this.then(null, onRejected);
};
return ZoneAwarePromise;
}());
var NativePromise = global[__symbol__('Promise')] = global.Promise;
global.Promise = ZoneAwarePromise;
if (NativePromise) {
var NativePromiseProtototype = NativePromise.prototype;
var NativePromiseThen_1 = NativePromiseProtototype[__symbol__('then')]
= NativePromiseProtototype.then;
NativePromiseProtototype.then = function (onResolve, onReject) {
var nativePromise = this;
return new ZoneAwarePromise(function (resolve, reject) {
NativePromiseThen_1.call(nativePromise, resolve, reject);
}).then(onResolve, onReject);
};
}
return global.Zone = Zone;
})(typeof window === 'undefined' ? global : window);
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var utils_1 = __webpack_require__(3);
var WTF_ISSUE_555 = 'Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video';
var NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex'.split(',');
var EVENT_TARGET = 'EventTarget';
function eventTargetPatch(_global) {
var apis = [];
var isWtf = _global['wtf'];
if (isWtf) {
// Workaround for: https://github.com/google/tracing-framework/issues/555
apis = WTF_ISSUE_555.split(',').map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET);
}
else if (_global[EVENT_TARGET]) {
apis.push(EVENT_TARGET);
}
else {
// Note: EventTarget is not available in all browsers,
// if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
apis = NO_EVENT_TARGET;
}
for (var i = 0; i < apis.length; i++) {
var type = _global[apis[i]];
utils_1.patchEventTargetMethods(type && type.prototype);
}
}
exports.eventTargetPatch = eventTargetPatch;
/***/ },
/* 3 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* Suppress closure compiler errors about unknown 'process' variable
* @fileoverview
* @suppress {undefinedVars}
*/
"use strict";
exports.zoneSymbol = Zone['__symbol__'];
var _global = typeof window == 'undefined' ? global : window;
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;
}
exports.bindArguments = bindArguments;
;
function patchPrototype(prototype, fnNames) {
var source = prototype.constructor['name'];
var _loop_1 = function(i) {
var name_1 = fnNames[i];
var delegate = prototype[name_1];
if (delegate) {
prototype[name_1] = (function (delegate) {
return function () {
return delegate.apply(this, bindArguments(arguments, source + '.' + name_1));
};
})(delegate);
}
};
for (var i = 0; i < fnNames.length; i++) {
_loop_1(i);
}
}
exports.patchPrototype = patchPrototype;
;
exports.isWebWorker = (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope);
exports.isNode = (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]');
exports.isBrowser = !exports.isNode && !exports.isWebWorker && !!(typeof window !== 'undefined' && window['HTMLElement']);
function patchProperty(obj, prop) {
var desc = Object.getOwnPropertyDescriptor(obj, prop) || {
enumerable: true,
configurable: true
};
// A property descriptor cannot have getter/setter and be writable
// deleting the writable and value properties avoids this error:
//
// TypeError: property descriptors must not specify a value or be writable when a
// getter or setter has been specified
delete desc.writable;
delete desc.value;
// substr(2) cuz 'onclick' -> 'click', etc
var eventName = prop.substr(2);
var _prop = '_' + prop;
desc.set = function (fn) {
if (this[_prop]) {
this.removeEventListener(eventName, this[_prop]);
}
if (typeof fn === 'function') {
var wrapFn = function (event) {
var result;
result = fn.apply(this, arguments);
if (result != undefined && !result)
event.preventDefault();
};
this[_prop] = wrapFn;
this.addEventListener(eventName, wrapFn, false);
}
else {
this[_prop] = null;
}
};
desc.get = function () {
return this[_prop];
};
Object.defineProperty(obj, prop, desc);
}
exports.patchProperty = patchProperty;
;
function patchOnProperties(obj, properties) {
var onProperties = [];
for (var prop in obj) {
if (prop.substr(0, 2) == 'on') {
onProperties.push(prop);
}
}
for (var j = 0; j < onProperties.length; j++) {
patchProperty(obj, onProperties[j]);
}
if (properties) {
for (var i = 0; i < properties.length; i++) {
patchProperty(obj, 'on' + properties[i]);
}
}
}
exports.patchOnProperties = patchOnProperties;
;
var EVENT_TASKS = exports.zoneSymbol('eventTasks');
var ADD_EVENT_LISTENER = 'addEventListener';
var REMOVE_EVENT_LISTENER = 'removeEventListener';
var SYMBOL_ADD_EVENT_LISTENER = exports.zoneSymbol(ADD_EVENT_LISTENER);
var SYMBOL_REMOVE_EVENT_LISTENER = exports.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 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;
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[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
};
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;
var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, true);
if (eventTask) {
eventTask.zone.cancelTask(eventTask);
}
else {
target[SYMBOL_REMOVE_EVENT_LISTENER](eventName, handler, useCapturing);
}
}
function patchEventTargetMethods(obj) {
if (obj && obj.addEventListener) {
patchMethod(obj, ADD_EVENT_LISTENER, function () { return zoneAwareAddEventListener; });
patchMethod(obj, REMOVE_EVENT_LISTENER, function () { return zoneAwareRemoveEventListener; });
return true;
}
else {
return false;
}
}
exports.patchEventTargetMethods = patchEventTargetMethods;
;
var originalInstanceKey = exports.zoneSymbol('originalInstance');
// wrap some native API on `window`
function patchClass(className) {
var OriginalClass = _global[className];
if (!OriginalClass)
return;
_global[className] = function () {
var a = bindArguments(arguments, className);
switch (a.length) {
case 0:
this[originalInstanceKey] = new OriginalClass();
break;
case 1:
this[originalInstanceKey] = new OriginalClass(a[0]);
break;
case 2:
this[originalInstanceKey] = new OriginalClass(a[0], a[1]);
break;
case 3:
this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);
break;
case 4:
this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);
break;
default: throw new Error('Arg list too long.');
}
};
var instance = new OriginalClass(function () { });
var prop;
for (prop in instance) {
(function (prop) {
if (typeof instance[prop] === 'function') {
_global[className].prototype[prop] = function () {
return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments);
};
}
else {
Object.defineProperty(_global[className].prototype, prop, {
set: function (fn) {
if (typeof fn === 'function') {
this[originalInstanceKey][prop] = Zone.current.wrap(fn, className + '.' + prop);
}
else {
this[originalInstanceKey][prop] = fn;
}
},
get: function () {
return this[originalInstanceKey][prop];
}
});
}
}(prop));
}
for (prop in OriginalClass) {
if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) {
_global[className][prop] = OriginalClass[prop];
}
}
}
exports.patchClass = patchClass;
;
function createNamedFn(name, delegate) {
try {
return (Function('f', "return function " + name + "(){return f(this, arguments)}"))(delegate);
}
catch (e) {
// if we fail, we must be CSP, just return delegate.
return function () {
return delegate(this, arguments);
};
}
}
exports.createNamedFn = createNamedFn;
function patchMethod(target, name, patchFn) {
var proto = target;
while (proto && !proto.hasOwnProperty(name)) {
proto = Object.getPrototypeOf(proto);
}
if (!proto && target[name]) {
// somehow we did not find it, but we can see it. This happens on IE for Window properties.
proto = target;
}
var delegateName = exports.zoneSymbol(name);
var delegate;
if (proto && !(delegate = proto[delegateName])) {
delegate = proto[delegateName] = proto[name];
proto[name] = createNamedFn(name, patchFn(delegate, delegateName, name));
}
return delegate;
}
exports.patchMethod = patchMethod;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var utils_1 = __webpack_require__(3);
/*
* This is necessary for Chrome and Chrome mobile, to enable
* things like redefining `createdCallback` on an element.
*/
var _defineProperty = Object.defineProperty;
var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var _create = Object.create;
var unconfigurablesKey = utils_1.zoneSymbol('unconfigurables');
function propertyPatch() {
Object.defineProperty = function (obj, prop, desc) {
if (isUnconfigurable(obj, prop)) {
throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj);
}
if (prop !== 'prototype') {
desc = rewriteDescriptor(obj, prop, desc);
}
return _defineProperty(obj, prop, desc);
};
Object.defineProperties = function (obj, props) {
Object.keys(props).forEach(function (prop) {
Object.defineProperty(obj, prop, props[prop]);
});
return obj;
};
Object.create = function (obj, proto) {
if (typeof proto === 'object') {
Object.keys(proto).forEach(function (prop) {
proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);
});
}
return _create(obj, proto);
};
Object.getOwnPropertyDescriptor = function (obj, prop) {
var desc = _getOwnPropertyDescriptor(obj, prop);
if (isUnconfigurable(obj, prop)) {
desc.configurable = false;
}
return desc;
};
}
exports.propertyPatch = propertyPatch;
;
function _redefineProperty(obj, prop, desc) {
desc = rewriteDescriptor(obj, prop, desc);
return _defineProperty(obj, prop, desc);
}
exports._redefineProperty = _redefineProperty;
;
function isUnconfigurable(obj, prop) {
return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop];
}
function rewriteDescriptor(obj, prop, desc) {
desc.configurable = true;
if (!desc.configurable) {
if (!obj[unconfigurablesKey]) {
_defineProperty(obj, unconfigurablesKey, { writable: true, value: {} });
}
obj[unconfigurablesKey][prop] = true;
}
return desc;
}
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var define_property_1 = __webpack_require__(4);
var utils_1 = __webpack_require__(3);
function registerElementPatch(_global) {
if (!utils_1.isBrowser || !('registerElement' in _global.document)) {
return;
}
var _registerElement = document.registerElement;
var callbacks = [
'createdCallback',
'attachedCallback',
'detachedCallback',
'attributeChangedCallback'
];
document.registerElement = function (name, opts) {
if (opts && opts.prototype) {
callbacks.forEach(function (callback) {
var source = 'Document.registerElement::' + callback;
if (opts.prototype.hasOwnProperty(callback)) {
var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback);
if (descriptor && descriptor.value) {
descriptor.value = Zone.current.wrap(descriptor.value, source);
define_property_1._redefineProperty(opts.prototype, callback, descriptor);
}
else {
opts.prototype[callback] = Zone.current.wrap(opts.prototype[callback], source);
}
}
else if (opts.prototype[callback]) {
opts.prototype[callback] = Zone.current.wrap(opts.prototype[callback], source);
}
});
}
return _registerElement.apply(document, [name, opts]);
};
}
exports.registerElementPatch = registerElementPatch;
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var webSocketPatch = __webpack_require__(7);
var utils_1 = __webpack_require__(3);
var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' ');
function propertyDescriptorPatch(_global) {
if (utils_1.isNode) {
return;
}
var supportsWebSocket = typeof WebSocket !== 'undefined';
if (canPatchViaPropertyDescriptor()) {
// for browsers that we can patch the descriptor: Chrome & Firefox
if (utils_1.isBrowser) {
utils_1.patchOnProperties(HTMLElement.prototype, eventNames);
}
utils_1.patchOnProperties(XMLHttpRequest.prototype, null);
if (typeof IDBIndex !== 'undefined') {
utils_1.patchOnProperties(IDBIndex.prototype, null);
utils_1.patchOnProperties(IDBRequest.prototype, null);
utils_1.patchOnProperties(IDBOpenDBRequest.prototype, null);
utils_1.patchOnProperties(IDBDatabase.prototype, null);
utils_1.patchOnProperties(IDBTransaction.prototype, null);
utils_1.patchOnProperties(IDBCursor.prototype, null);
}
if (supportsWebSocket) {
utils_1.patchOnProperties(WebSocket.prototype, null);
}
}
else {
// Safari, Android browsers (Jelly Bean)
patchViaCapturingAllTheEvents();
utils_1.patchClass('XMLHttpRequest');
if (supportsWebSocket) {
webSocketPatch.apply(_global);
}
}
}
exports.propertyDescriptorPatch = propertyDescriptorPatch;
function canPatchViaPropertyDescriptor() {
if (utils_1.isBrowser && !Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick')
&& typeof Element !== 'undefined') {
// WebKit https://bugs.webkit.org/show_bug.cgi?id=134364
// IDL interface attributes are not configurable
var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick');
if (desc && !desc.configurable)
return false;
}
Object.defineProperty(XMLHttpRequest.prototype, 'onreadystatechange', {
get: function () {
return true;
}
});
var req = new XMLHttpRequest();
var result = !!req.onreadystatechange;
Object.defineProperty(XMLHttpRequest.prototype, 'onreadystatechange', {});
return result;
}
;
var unboundKey = utils_1.zoneSymbol('unbound');
// Whenever any eventListener fires, we check the eventListener target and all parents
// for `onwhatever` properties and replace them with zone-bound functions
// - Chrome (for now)
function patchViaCapturingAllTheEvents() {
var _loop_1 = function(i) {
var property = eventNames[i];
var onproperty = 'on' + property;
document.addEventListener(property, function (event) {
var elt = event.target, bound, source;
if (elt) {
source = elt.constructor['name'] + '.' + onproperty;
}
else {
source = 'unknown.' + onproperty;
}
while (elt) {
if (elt[onproperty] && !elt[onproperty][unboundKey]) {
bound = Zone.current.wrap(elt[onproperty], source);
bound[unboundKey] = elt[onproperty];
elt[onproperty] = bound;
}
elt = elt.parentElement;
}
}, true);
};
for (var i = 0; i < eventNames.length; i++) {
_loop_1(i);
}
;
}
;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var utils_1 = __webpack_require__(3);
// we have to patch the instance since the proto is non-configurable
function apply(_global) {
var WS = _global.WebSocket;
// On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener
// On older Chrome, no need since EventTarget was already patched
if (!_global.EventTarget) {
utils_1.patchEventTargetMethods(WS.prototype);
}
_global.WebSocket = function (a, b) {
var socket = arguments.length > 1 ? new WS(a, b) : new WS(a);
var proxySocket;
// Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance
var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage');
if (onmessageDesc && onmessageDesc.configurable === false) {
proxySocket = Object.create(socket);
['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function (propName) {
proxySocket[propName] = function () {
return socket[propName].apply(socket, arguments);
};
});
}
else {
// we can patch the real socket
proxySocket = socket;
}
utils_1.patchOnProperties(proxySocket, ['close', 'error', 'message', 'open']);
return proxySocket;
};
for (var prop in WS) {
_global.WebSocket[prop] = WS[prop];
}
}
exports.apply = apply;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var utils_1 = __webpack_require__(3);
function patchTimer(window, setName, cancelName, nameSuffix) {
var setNative = null;
var clearNative = null;
setName += nameSuffix;
cancelName += nameSuffix;
function scheduleTask(task) {
var data = task.data;
data.args[0] = task.invoke;
data.handleId = setNative.apply(window, data.args);
return task;
}
function clearTask(task) {
return clearNative(task.data.handleId);
}
setNative = utils_1.patchMethod(window, setName, function (delegate) { return function (self, args) {
if (typeof args[0] === 'function') {
var zone = Zone.current;
var options = {
handleId: null,
isPeriodic: nameSuffix === 'Interval',
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 : null,
args: args
};
return zone.scheduleMacroTask(setName, args[0], options, scheduleTask, clearTask);
}
else {
// cause an error by calling it directly.
return delegate.apply(window, args);
}
}; });
clearNative = utils_1.patchMethod(window, cancelName, function (delegate) { return function (self, args) {
var task = args[0];
if (task && typeof task.type === 'string') {
if (task.cancelFn && task.data.isPeriodic || task.runCount === 0) {
// Do not cancel already canceled functions
task.zone.cancelTask(task);
}
}
else {
// cause an error by calling it directly.
delegate.apply(window, args);
}
}; });
}
exports.patchTimer = patchTimer;
/***/ }
/******/ ]);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(133)))
/***/ },
/* 458 */
/***/ function(module, exports) {
/* (ignored) */
/***/ },
/* 459 */
/***/ function(module, exports, __webpack_require__, __webpack_module_template_argument_0__, __webpack_module_template_argument_1__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var lang_1 = __webpack_require__(__webpack_module_template_argument_0__);
var promise_1 = __webpack_require__(__webpack_module_template_argument_1__);
exports.PromiseWrapper = promise_1.PromiseWrapper;
exports.PromiseCompleter = promise_1.PromiseCompleter;
var Subject_1 = __webpack_require__(37);
var PromiseObservable_1 = __webpack_require__(135);
var toPromise_1 = __webpack_require__(136);
var Observable_1 = __webpack_require__(42);
exports.Observable = Observable_1.Observable;
var Subject_2 = __webpack_require__(37);
exports.Subject = Subject_2.Subject;
var TimerWrapper = (function () {
function TimerWrapper() {
}
TimerWrapper.setTimeout = function (fn, millis) {
return lang_1.global.setTimeout(fn, millis);
};
TimerWrapper.clearTimeout = function (id) { lang_1.global.clearTimeout(id); };
TimerWrapper.setInterval = function (fn, millis) {
return lang_1.global.setInterval(fn, millis);
};
TimerWrapper.clearInterval = function (id) { lang_1.global.clearInterval(id); };
return TimerWrapper;
}());
exports.TimerWrapper = TimerWrapper;
var ObservableWrapper = (function () {
function ObservableWrapper() {
}
// TODO(vsavkin): when we use rxnext, try inferring the generic type from the first arg
ObservableWrapper.subscribe = function (emitter, onNext, onError, onComplete) {
if (onComplete === void 0) { onComplete = function () { }; }
onError = (typeof onError === "function") && onError || lang_1.noop;
onComplete = (typeof onComplete === "function") && onComplete || lang_1.noop;
return emitter.subscribe({ next: onNext, error: onError, complete: onComplete });
};
ObservableWrapper.isObservable = function (obs) { return !!obs.subscribe; };
/**
* Returns whether `obs` has any subscribers listening to events.
*/
ObservableWrapper.hasSubscribers = function (obs) { return obs.observers.length > 0; };
ObservableWrapper.dispose = function (subscription) { subscription.unsubscribe(); };
/**
* @deprecated - use callEmit() instead
*/
ObservableWrapper.callNext = function (emitter, value) { emitter.next(value); };
ObservableWrapper.callEmit = function (emitter, value) { emitter.emit(value); };
ObservableWrapper.callError = function (emitter, error) { emitter.error(error); };
ObservableWrapper.callComplete = function (emitter) { emitter.complete(); };
ObservableWrapper.fromPromise = function (promise) {
return PromiseObservable_1.PromiseObservable.create(promise);
};
ObservableWrapper.toPromise = function (obj) { return toPromise_1.toPromise.call(obj); };
return ObservableWrapper;
}());
exports.ObservableWrapper = ObservableWrapper;
/**
* Use by directives and components to emit custom Events.
*
* ### Examples
*
* In the following example, `Zippy` alternatively emits `open` and `close` events when its
* title gets clicked:
*
* ```
* @Component({
* selector: 'zippy',
* template: `
* `})
* export class Zippy {
* visible: boolean = true;
* @Output() open: EventEmitter = new EventEmitter();
* @Output() close: EventEmitter = new EventEmitter();
*
* toggle() {
* this.visible = !this.visible;
* if (this.visible) {
* this.open.emit(null);
* } else {
* this.close.emit(null);
* }
* }
* }
* ```
*
* Use Rx.Observable but provides an adapter to make it work as specified here:
* https://github.com/jhusain/observable-spec
*
* Once a reference implementation of the spec is available, switch to it.
*/
var EventEmitter = (function (_super) {
__extends(EventEmitter, _super);
/**
* Creates an instance of [EventEmitter], which depending on [isAsync],
* delivers events synchronously or asynchronously.
*/
function EventEmitter(isAsync) {
if (isAsync === void 0) { isAsync = true; }
_super.call(this);
this._isAsync = isAsync;
}
EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
/**
* @deprecated - use .emit(value) instead
*/
EventEmitter.prototype.next = function (value) { _super.prototype.next.call(this, value); };
EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
var schedulerFn;
var errorFn = function (err) { return null; };
var completeFn = function () { return null; };
if (generatorOrNext && typeof generatorOrNext === 'object') {
schedulerFn = this._isAsync ? function (value) { setTimeout(function () { return generatorOrNext.next(value); }); } :
function (value) { generatorOrNext.next(value); };
if (generatorOrNext.error) {
errorFn = this._isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
function (err) { generatorOrNext.error(err); };
}
if (generatorOrNext.complete) {
completeFn = this._isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
function () { generatorOrNext.complete(); };
}
}
else {
schedulerFn = this._isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
function (value) { generatorOrNext(value); };
if (error) {
errorFn =
this._isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
}
if (complete) {
completeFn =
this._isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
}
}
return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
};
return EventEmitter;
}(Subject_1.Subject));
exports.EventEmitter = EventEmitter;
//# sourceMappingURL=async.js.map
/***/ },
/* 460 */
/***/ function(module, exports, __webpack_require__, __webpack_module_template_argument_0__) {
"use strict";
var lang_1 = __webpack_require__(__webpack_module_template_argument_0__);
exports.Map = lang_1.global.Map;
exports.Set = lang_1.global.Set;
// Safari and Internet Explorer do not support the iterable parameter to the
// Map constructor. We work around that by manually adding the items.
var createMapFromPairs = (function () {
try {
if (new exports.Map([[1, 2]]).size === 1) {
return function createMapFromPairs(pairs) { return new exports.Map(pairs); };
}
}
catch (e) {
}
return function createMapAndPopulateFromPairs(pairs) {
var map = new exports.Map();
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i];
map.set(pair[0], pair[1]);
}
return map;
};
})();
var createMapFromMap = (function () {
try {
if (new exports.Map(new exports.Map())) {
return function createMapFromMap(m) { return new exports.Map(m); };
}
}
catch (e) {
}
return function createMapAndPopulateFromMap(m) {
var map = new exports.Map();
m.forEach(function (v, k) { map.set(k, v); });
return map;
};
})();
var _clearValues = (function () {
if ((new exports.Map()).keys().next) {
return function _clearValues(m) {
var keyIterator = m.keys();
var k;
while (!((k = keyIterator.next()).done)) {
m.set(k.value, null);
}
};
}
else {
return function _clearValuesWithForeEach(m) {
m.forEach(function (v, k) { m.set(k, null); });
};
}
})();
// Safari doesn't implement MapIterator.next(), which is used is Traceur's polyfill of Array.from
// TODO(mlaval): remove the work around once we have a working polyfill of Array.from
var _arrayFromMap = (function () {
try {
if ((new exports.Map()).values().next) {
return function createArrayFromMap(m, getValues) {
return getValues ? Array.from(m.values()) : Array.from(m.keys());
};
}
}
catch (e) {
}
return function createArrayFromMapWithForeach(m, getValues) {
var res = ListWrapper.createFixedSize(m.size), i = 0;
m.forEach(function (v, k) {
res[i] = getValues ? v : k;
i++;
});
return res;
};
})();
var MapWrapper = (function () {
function MapWrapper() {
}
MapWrapper.clone = function (m) { return createMapFromMap(m); };
MapWrapper.createFromStringMap = function (stringMap) {
var result = new exports.Map();
for (var prop in stringMap) {
result.set(prop, stringMap[prop]);
}
return result;
};
MapWrapper.toStringMap = function (m) {
var r = {};
m.forEach(function (v, k) { return r[k] = v; });
return r;
};
MapWrapper.createFromPairs = function (pairs) { return createMapFromPairs(pairs); };
MapWrapper.clearValues = function (m) { _clearValues(m); };
MapWrapper.iterable = function (m) { return m; };
MapWrapper.keys = function (m) { return _arrayFromMap(m, false); };
MapWrapper.values = function (m) { return _arrayFromMap(m, true); };
return MapWrapper;
}());
exports.MapWrapper = MapWrapper;
/**
* Wraps Javascript Objects
*/
var StringMapWrapper = (function () {
function StringMapWrapper() {
}
StringMapWrapper.create = function () {
// Note: We are not using Object.create(null) here due to
// performance!
// http://jsperf.com/ng2-object-create-null
return {};
};
StringMapWrapper.contains = function (map, key) {
return map.hasOwnProperty(key);
};
StringMapWrapper.get = function (map, key) {
return map.hasOwnProperty(key) ? map[key] : undefined;
};
StringMapWrapper.set = function (map, key, value) { map[key] = value; };
StringMapWrapper.keys = function (map) { return Object.keys(map); };
StringMapWrapper.values = function (map) {
return Object.keys(map).reduce(function (r, a) {
r.push(map[a]);
return r;
}, []);
};
StringMapWrapper.isEmpty = function (map) {
for (var prop in map) {
return false;
}
return true;
};
StringMapWrapper.delete = function (map, key) { delete map[key]; };
StringMapWrapper.forEach = function (map, callback) {
for (var prop in map) {
if (map.hasOwnProperty(prop)) {
callback(map[prop], prop);
}
}
};
StringMapWrapper.merge = function (m1, m2) {
var m = {};
for (var attr in m1) {
if (m1.hasOwnProperty(attr)) {
m[attr] = m1[attr];
}
}
for (var attr in m2) {
if (m2.hasOwnProperty(attr)) {
m[attr] = m2[attr];
}
}
return m;
};
StringMapWrapper.equals = function (m1, m2) {
var k1 = Object.keys(m1);
var k2 = Object.keys(m2);
if (k1.length != k2.length) {
return false;
}
var key;
for (var i = 0; i < k1.length; i++) {
key = k1[i];
if (m1[key] !== m2[key]) {
return false;
}
}
return true;
};
return StringMapWrapper;
}());
exports.StringMapWrapper = StringMapWrapper;
var ListWrapper = (function () {
function ListWrapper() {
}
// JS has no way to express a statically fixed size list, but dart does so we
// keep both methods.
ListWrapper.createFixedSize = function (size) { return new Array(size); };
ListWrapper.createGrowableSize = function (size) { return new Array(size); };
ListWrapper.clone = function (array) { return array.slice(0); };
ListWrapper.forEachWithIndex = function (array, fn) {
for (var i = 0; i < array.length; i++) {
fn(array[i], i);
}
};
ListWrapper.first = function (array) {
if (!array)
return null;
return array[0];
};
ListWrapper.last = function (array) {
if (!array || array.length == 0)
return null;
return array[array.length - 1];
};
ListWrapper.indexOf = function (array, value, startIndex) {
if (startIndex === void 0) { startIndex = 0; }
return array.indexOf(value, startIndex);
};
ListWrapper.contains = function (list, el) { return list.indexOf(el) !== -1; };
ListWrapper.reversed = function (array) {
var a = ListWrapper.clone(array);
return a.reverse();
};
ListWrapper.concat = function (a, b) { return a.concat(b); };
ListWrapper.insert = function (list, index, value) { list.splice(index, 0, value); };
ListWrapper.removeAt = function (list, index) {
var res = list[index];
list.splice(index, 1);
return res;
};
ListWrapper.removeAll = function (list, items) {
for (var i = 0; i < items.length; ++i) {
var index = list.indexOf(items[i]);
list.splice(index, 1);
}
};
ListWrapper.remove = function (list, el) {
var index = list.indexOf(el);
if (index > -1) {
list.splice(index, 1);
return true;
}
return false;
};
ListWrapper.clear = function (list) { list.length = 0; };
ListWrapper.isEmpty = function (list) { return list.length == 0; };
ListWrapper.fill = function (list, value, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = null; }
list.fill(value, start, end === null ? list.length : end);
};
ListWrapper.equals = function (a, b) {
if (a.length != b.length)
return false;
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i])
return false;
}
return true;
};
ListWrapper.slice = function (l, from, to) {
if (from === void 0) { from = 0; }
if (to === void 0) { to = null; }
return l.slice(from, to === null ? undefined : to);
};
ListWrapper.splice = function (l, from, length) { return l.splice(from, length); };
ListWrapper.sort = function (l, compareFn) {
if (lang_1.isPresent(compareFn)) {
l.sort(compareFn);
}
else {
l.sort();
}
};
ListWrapper.toString = function (l) { return l.toString(); };
ListWrapper.toJSON = function (l) { return JSON.stringify(l); };
ListWrapper.maximum = function (list, predicate) {
if (list.length == 0) {
return null;
}
var solution = null;
var maxValue = -Infinity;
for (var index = 0; index < list.length; index++) {
var candidate = list[index];
if (lang_1.isBlank(candidate)) {
continue;
}
var candidateValue = predicate(candidate);
if (candidateValue > maxValue) {
solution = candidate;
maxValue = candidateValue;
}
}
return solution;
};
ListWrapper.flatten = function (list) {
var target = [];
_flattenArray(list, target);
return target;
};
ListWrapper.addAll = function (list, source) {
for (var i = 0; i < source.length; i++) {
list.push(source[i]);
}
};
return ListWrapper;
}());
exports.ListWrapper = ListWrapper;
function _flattenArray(source, target) {
if (lang_1.isPresent(source)) {
for (var i = 0; i < source.length; i++) {
var item = source[i];
if (lang_1.isArray(item)) {
_flattenArray(item, target);
}
else {
target.push(item);
}
}
}
return target;
}
function isListLikeIterable(obj) {
if (!lang_1.isJsObject(obj))
return false;
return lang_1.isArray(obj) ||
(!(obj instanceof exports.Map) &&
lang_1.getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
}
exports.isListLikeIterable = isListLikeIterable;
function areIterablesEqual(a, b, comparator) {
var iterator1 = a[lang_1.getSymbolIterator()]();
var iterator2 = b[lang_1.getSymbolIterator()]();
while (true) {
var item1 = iterator1.next();
var item2 = iterator2.next();
if (item1.done && item2.done)
return true;
if (item1.done || item2.done)
return false;
if (!comparator(item1.value, item2.value))
return false;
}
}
exports.areIterablesEqual = areIterablesEqual;
function iterateListLike(obj, fn) {
if (lang_1.isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
fn(obj[i]);
}
}
else {
var iterator = obj[lang_1.getSymbolIterator()]();
var item;
while (!((item = iterator.next()).done)) {
fn(item.value);
}
}
}
exports.iterateListLike = iterateListLike;
// Safari and Internet Explorer do not support the iterable parameter to the
// Set constructor. We work around that by manually adding the items.
var createSetFromList = (function () {
var test = new exports.Set([1, 2, 3]);
if (test.size === 3) {
return function createSetFromList(lst) { return new exports.Set(lst); };
}
else {
return function createSetAndPopulateFromList(lst) {
var res = new exports.Set(lst);
if (res.size !== lst.length) {
for (var i = 0; i < lst.length; i++) {
res.add(lst[i]);
}
}
return res;
};
}
})();
var SetWrapper = (function () {
function SetWrapper() {
}
SetWrapper.createFromList = function (lst) { return createSetFromList(lst); };
SetWrapper.has = function (s, key) { return s.has(key); };
SetWrapper.delete = function (m, k) { m.delete(k); };
return SetWrapper;
}());
exports.SetWrapper = SetWrapper;
//# sourceMappingURL=collection.js.map
/***/ },
/* 461 */
/***/ function(module, exports, __webpack_require__, __webpack_module_template_argument_0__, __webpack_module_template_argument_1__, __webpack_module_template_argument_2__) {
"use strict";
var lang_1 = __webpack_require__(__webpack_module_template_argument_0__);
var base_wrapped_exception_1 = __webpack_require__(__webpack_module_template_argument_1__);
var collection_1 = __webpack_require__(__webpack_module_template_argument_2__);
var _ArrayLogger = (function () {
function _ArrayLogger() {
this.res = [];
}
_ArrayLogger.prototype.log = function (s) { this.res.push(s); };
_ArrayLogger.prototype.logError = function (s) { this.res.push(s); };
_ArrayLogger.prototype.logGroup = function (s) { this.res.push(s); };
_ArrayLogger.prototype.logGroupEnd = function () { };
;
return _ArrayLogger;
}());
/**
* Provides a hook for centralized exception handling.
*
* The default implementation of `ExceptionHandler` prints error messages to the `Console`. To
* intercept error handling,
* write a custom exception handler that replaces this default as appropriate for your app.
*
* ### Example
*
* ```javascript
*
* class MyExceptionHandler implements ExceptionHandler {
* call(error, stackTrace = null, reason = null) {
* // do something with the exception
* }
* }
*
* bootstrap(MyApp, [provide(ExceptionHandler, {useClass: MyExceptionHandler})])
*
* ```
*/
var ExceptionHandler = (function () {
function ExceptionHandler(_logger, _rethrowException) {
if (_rethrowException === void 0) { _rethrowException = true; }
this._logger = _logger;
this._rethrowException = _rethrowException;
}
ExceptionHandler.exceptionToString = function (exception, stackTrace, reason) {
if (stackTrace === void 0) { stackTrace = null; }
if (reason === void 0) { reason = null; }
var l = new _ArrayLogger();
var e = new ExceptionHandler(l, false);
e.call(exception, stackTrace, reason);
return l.res.join("\n");
};
ExceptionHandler.prototype.call = function (exception, stackTrace, reason) {
if (stackTrace === void 0) { stackTrace = null; }
if (reason === void 0) { reason = null; }
var originalException = this._findOriginalException(exception);
var originalStack = this._findOriginalStack(exception);
var context = this._findContext(exception);
this._logger.logGroup("EXCEPTION: " + this._extractMessage(exception));
if (lang_1.isPresent(stackTrace) && lang_1.isBlank(originalStack)) {
this._logger.logError("STACKTRACE:");
this._logger.logError(this._longStackTrace(stackTrace));
}
if (lang_1.isPresent(reason)) {
this._logger.logError("REASON: " + reason);
}
if (lang_1.isPresent(originalException)) {
this._logger.logError("ORIGINAL EXCEPTION: " + this._extractMessage(originalException));
}
if (lang_1.isPresent(originalStack)) {
this._logger.logError("ORIGINAL STACKTRACE:");
this._logger.logError(this._longStackTrace(originalStack));
}
if (lang_1.isPresent(context)) {
this._logger.logError("ERROR CONTEXT:");
this._logger.logError(context);
}
this._logger.logGroupEnd();
// We rethrow exceptions, so operations like 'bootstrap' will result in an error
// when an exception happens. If we do not rethrow, bootstrap will always succeed.
if (this._rethrowException)
throw exception;
};
/** @internal */
ExceptionHandler.prototype._extractMessage = function (exception) {
return exception instanceof base_wrapped_exception_1.BaseWrappedException ? exception.wrapperMessage :
exception.toString();
};
/** @internal */
ExceptionHandler.prototype._longStackTrace = function (stackTrace) {
return collection_1.isListLikeIterable(stackTrace) ? stackTrace.join("\n\n-----async gap-----\n") :
stackTrace.toString();
};
/** @internal */
ExceptionHandler.prototype._findContext = function (exception) {
try {
if (!(exception instanceof base_wrapped_exception_1.BaseWrappedException))
return null;
return lang_1.isPresent(exception.context) ? exception.context :
this._findContext(exception.originalException);
}
catch (e) {
// exception.context can throw an exception. if it happens, we ignore the context.
return null;
}
};
/** @internal */
ExceptionHandler.prototype._findOriginalException = function (exception) {
if (!(exception instanceof base_wrapped_exception_1.BaseWrappedException))
return null;
var e = exception.originalException;
while (e instanceof base_wrapped_exception_1.BaseWrappedException && lang_1.isPresent(e.originalException)) {
e = e.originalException;
}
return e;
};
/** @internal */
ExceptionHandler.prototype._findOriginalStack = function (exception) {
if (!(exception instanceof base_wrapped_exception_1.BaseWrappedException))
return null;
var e = exception;
var stack = exception.originalStack;
while (e instanceof base_wrapped_exception_1.BaseWrappedException && lang_1.isPresent(e.originalException)) {
e = e.originalException;
if (e instanceof base_wrapped_exception_1.BaseWrappedException && lang_1.isPresent(e.originalException)) {
stack = e.originalStack;
}
}
return stack;
};
return ExceptionHandler;
}());
exports.ExceptionHandler = ExceptionHandler;
//# sourceMappingURL=exception_handler.js.map
/***/ },
/* 462 */
/***/ function(module, exports, __webpack_require__, __webpack_module_template_argument_0__, __webpack_module_template_argument_1__, __webpack_module_template_argument_2__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var base_wrapped_exception_1 = __webpack_require__(__webpack_module_template_argument_0__);
var exception_handler_1 = __webpack_require__(__webpack_module_template_argument_1__);
var exception_handler_2 = __webpack_require__(__webpack_module_template_argument_2__);
exports.ExceptionHandler = exception_handler_2.ExceptionHandler;
var BaseException = (function (_super) {
__extends(BaseException, _super);
function BaseException(message) {
if (message === void 0) { message = "--"; }
_super.call(this, message);
this.message = message;
this.stack = (new Error(message)).stack;
}
BaseException.prototype.toString = function () { return this.message; };
return BaseException;
}(Error));
exports.BaseException = BaseException;
/**
* Wraps an exception and provides additional context or information.
*/
var WrappedException = (function (_super) {
__extends(WrappedException, _super);
function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) {
_super.call(this, _wrapperMessage);
this._wrapperMessage = _wrapperMessage;
this._originalException = _originalException;
this._originalStack = _originalStack;
this._context = _context;
this._wrapperStack = (new Error(_wrapperMessage)).stack;
}
Object.defineProperty(WrappedException.prototype, "wrapperMessage", {
get: function () { return this._wrapperMessage; },
enumerable: true,
configurable: true
});
Object.defineProperty(WrappedException.prototype, "wrapperStack", {
get: function () { return this._wrapperStack; },
enumerable: true,
configurable: true
});
Object.defineProperty(WrappedException.prototype, "originalException", {
get: function () { return this._originalException; },
enumerable: true,
configurable: true
});
Object.defineProperty(WrappedException.prototype, "originalStack", {
get: function () { return this._originalStack; },
enumerable: true,
configurable: true
});
Object.defineProperty(WrappedException.prototype, "context", {
get: function () { return this._context; },
enumerable: true,
configurable: true
});
Object.defineProperty(WrappedException.prototype, "message", {
get: function () { return exception_handler_1.ExceptionHandler.exceptionToString(this); },
enumerable: true,
configurable: true
});
WrappedException.prototype.toString = function () { return this.message; };
return WrappedException;
}(base_wrapped_exception_1.BaseWrappedException));
exports.WrappedException = WrappedException;
function makeTypeError(message) {
return new TypeError(message);
}
exports.makeTypeError = makeTypeError;
function unimplemented() {
throw new BaseException('unimplemented');
}
exports.unimplemented = unimplemented;
//# sourceMappingURL=exceptions.js.map
/***/ }
/******/ ])));
//# sourceMappingURL=angular2.js.map