This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"format register"; | |
System.register("angular2/src/facade/lang", [], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
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 globalScope; | |
if (typeof window === 'undefined') { | |
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { | |
globalScope = self; | |
} else { | |
globalScope = global; | |
} | |
} else { | |
globalScope = window; | |
} | |
; | |
exports.IS_DART = false; | |
var _global = globalScope; | |
exports.global = _global; | |
exports.Type = Function; | |
function getTypeNameForDebugging(type) { | |
return type['name']; | |
} | |
exports.getTypeNameForDebugging = getTypeNameForDebugging; | |
exports.Math = _global.Math; | |
exports.Date = _global.Date; | |
var _devMode = true; | |
var _modeLocked = false; | |
function lockMode() { | |
_modeLocked = true; | |
} | |
exports.lockMode = lockMode; | |
function enableProdMode() { | |
if (_modeLocked) { | |
throw 'Cannot enable prod mode after platform setup.'; | |
} | |
_devMode = false; | |
} | |
exports.enableProdMode = enableProdMode; | |
function assertionsEnabled() { | |
return _devMode; | |
} | |
exports.assertionsEnabled = assertionsEnabled; | |
_global.assert = function assert(condition) {}; | |
function CONST_EXPR(expr) { | |
return expr; | |
} | |
exports.CONST_EXPR = CONST_EXPR; | |
function CONST() { | |
return function(target) { | |
return target; | |
}; | |
} | |
exports.CONST = CONST; | |
function isPresent(obj) { | |
return obj !== undefined && obj !== null; | |
} | |
exports.isPresent = isPresent; | |
function isBlank(obj) { | |
return obj === undefined || obj === null; | |
} | |
exports.isBlank = isBlank; | |
function isString(obj) { | |
return typeof obj === "string"; | |
} | |
exports.isString = isString; | |
function isFunction(obj) { | |
return typeof obj === "function"; | |
} | |
exports.isFunction = isFunction; | |
function isType(obj) { | |
return isFunction(obj); | |
} | |
exports.isType = isType; | |
function isStringMap(obj) { | |
return typeof obj === 'object' && obj !== null; | |
} | |
exports.isStringMap = isStringMap; | |
function isPromise(obj) { | |
return obj instanceof _global.Promise; | |
} | |
exports.isPromise = isPromise; | |
function isArray(obj) { | |
return Array.isArray(obj); | |
} | |
exports.isArray = isArray; | |
function isNumber(obj) { | |
return typeof obj === 'number'; | |
} | |
exports.isNumber = isNumber; | |
function isDate(obj) { | |
return obj instanceof exports.Date && !isNaN(obj.valueOf()); | |
} | |
exports.isDate = isDate; | |
function noop() {} | |
exports.noop = noop; | |
function stringify(token) { | |
if (typeof token === 'string') { | |
return token; | |
} | |
if (token === undefined || token === null) { | |
return '' + token; | |
} | |
if (token.name) { | |
return token.name; | |
} | |
var res = token.toString(); | |
var newLineIndex = res.indexOf("\n"); | |
return (newLineIndex === -1) ? res : res.substring(0, newLineIndex); | |
} | |
exports.stringify = stringify; | |
function serializeEnum(val) { | |
return val; | |
} | |
exports.serializeEnum = serializeEnum; | |
function deserializeEnum(val, values) { | |
return val; | |
} | |
exports.deserializeEnum = deserializeEnum; | |
var StringWrapper = (function() { | |
function StringWrapper() {} | |
StringWrapper.fromCharCode = function(code) { | |
return String.fromCharCode(code); | |
}; | |
StringWrapper.charCodeAt = function(s, index) { | |
return s.charCodeAt(index); | |
}; | |
StringWrapper.split = function(s, regExp) { | |
return s.split(regExp); | |
}; | |
StringWrapper.equals = function(s, s2) { | |
return s === s2; | |
}; | |
StringWrapper.stripLeft = function(s, charVal) { | |
if (s && s.length) { | |
var pos = 0; | |
for (var i = 0; i < s.length; i++) { | |
if (s[i] != charVal) | |
break; | |
pos++; | |
} | |
s = s.substring(pos); | |
} | |
return s; | |
}; | |
StringWrapper.stripRight = function(s, charVal) { | |
if (s && s.length) { | |
var pos = s.length; | |
for (var i = s.length - 1; i >= 0; i--) { | |
if (s[i] != charVal) | |
break; | |
pos--; | |
} | |
s = s.substring(0, pos); | |
} | |
return s; | |
}; | |
StringWrapper.replace = function(s, from, replace) { | |
return s.replace(from, replace); | |
}; | |
StringWrapper.replaceAll = function(s, from, replace) { | |
return s.replace(from, replace); | |
}; | |
StringWrapper.slice = function(s, from, to) { | |
if (from === void 0) { | |
from = 0; | |
} | |
if (to === void 0) { | |
to = null; | |
} | |
return s.slice(from, to === null ? undefined : to); | |
}; | |
StringWrapper.replaceAllMapped = function(s, from, cb) { | |
return s.replace(from, function() { | |
var matches = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
matches[_i - 0] = arguments[_i]; | |
} | |
matches.splice(-2, 2); | |
return cb(matches); | |
}); | |
}; | |
StringWrapper.contains = function(s, substr) { | |
return s.indexOf(substr) != -1; | |
}; | |
StringWrapper.compare = function(a, b) { | |
if (a < b) { | |
return -1; | |
} else if (a > b) { | |
return 1; | |
} else { | |
return 0; | |
} | |
}; | |
return StringWrapper; | |
})(); | |
exports.StringWrapper = StringWrapper; | |
var StringJoiner = (function() { | |
function StringJoiner(parts) { | |
if (parts === void 0) { | |
parts = []; | |
} | |
this.parts = parts; | |
} | |
StringJoiner.prototype.add = function(part) { | |
this.parts.push(part); | |
}; | |
StringJoiner.prototype.toString = function() { | |
return this.parts.join(""); | |
}; | |
return StringJoiner; | |
})(); | |
exports.StringJoiner = StringJoiner; | |
var NumberParseError = (function(_super) { | |
__extends(NumberParseError, _super); | |
function NumberParseError(message) { | |
_super.call(this); | |
this.message = message; | |
} | |
NumberParseError.prototype.toString = function() { | |
return this.message; | |
}; | |
return NumberParseError; | |
})(Error); | |
exports.NumberParseError = NumberParseError; | |
var NumberWrapper = (function() { | |
function NumberWrapper() {} | |
NumberWrapper.toFixed = function(n, fractionDigits) { | |
return n.toFixed(fractionDigits); | |
}; | |
NumberWrapper.equal = function(a, b) { | |
return a === b; | |
}; | |
NumberWrapper.parseIntAutoRadix = function(text) { | |
var result = parseInt(text); | |
if (isNaN(result)) { | |
throw new NumberParseError("Invalid integer literal when parsing " + text); | |
} | |
return result; | |
}; | |
NumberWrapper.parseInt = function(text, radix) { | |
if (radix == 10) { | |
if (/^(\-|\+)?[0-9]+$/.test(text)) { | |
return parseInt(text, radix); | |
} | |
} else if (radix == 16) { | |
if (/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(text)) { | |
return parseInt(text, radix); | |
} | |
} else { | |
var result = parseInt(text, radix); | |
if (!isNaN(result)) { | |
return result; | |
} | |
} | |
throw new NumberParseError("Invalid integer literal when parsing " + text + " in base " + radix); | |
}; | |
NumberWrapper.parseFloat = function(text) { | |
return parseFloat(text); | |
}; | |
Object.defineProperty(NumberWrapper, "NaN", { | |
get: function() { | |
return NaN; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
NumberWrapper.isNaN = function(value) { | |
return isNaN(value); | |
}; | |
NumberWrapper.isInteger = function(value) { | |
return Number.isInteger(value); | |
}; | |
return NumberWrapper; | |
})(); | |
exports.NumberWrapper = NumberWrapper; | |
exports.RegExp = _global.RegExp; | |
var RegExpWrapper = (function() { | |
function RegExpWrapper() {} | |
RegExpWrapper.create = function(regExpStr, flags) { | |
if (flags === void 0) { | |
flags = ''; | |
} | |
flags = flags.replace(/g/g, ''); | |
return new _global.RegExp(regExpStr, flags + 'g'); | |
}; | |
RegExpWrapper.firstMatch = function(regExp, input) { | |
regExp.lastIndex = 0; | |
return regExp.exec(input); | |
}; | |
RegExpWrapper.test = function(regExp, input) { | |
regExp.lastIndex = 0; | |
return regExp.test(input); | |
}; | |
RegExpWrapper.matcher = function(regExp, input) { | |
regExp.lastIndex = 0; | |
return { | |
re: regExp, | |
input: input | |
}; | |
}; | |
return RegExpWrapper; | |
})(); | |
exports.RegExpWrapper = RegExpWrapper; | |
var RegExpMatcherWrapper = (function() { | |
function RegExpMatcherWrapper() {} | |
RegExpMatcherWrapper.next = function(matcher) { | |
return matcher.re.exec(matcher.input); | |
}; | |
return RegExpMatcherWrapper; | |
})(); | |
exports.RegExpMatcherWrapper = RegExpMatcherWrapper; | |
var FunctionWrapper = (function() { | |
function FunctionWrapper() {} | |
FunctionWrapper.apply = function(fn, posArgs) { | |
return fn.apply(null, posArgs); | |
}; | |
return FunctionWrapper; | |
})(); | |
exports.FunctionWrapper = FunctionWrapper; | |
function looseIdentical(a, b) { | |
return a === b || typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b); | |
} | |
exports.looseIdentical = looseIdentical; | |
function getMapKey(value) { | |
return value; | |
} | |
exports.getMapKey = getMapKey; | |
function normalizeBlank(obj) { | |
return isBlank(obj) ? null : obj; | |
} | |
exports.normalizeBlank = normalizeBlank; | |
function normalizeBool(obj) { | |
return isBlank(obj) ? false : obj; | |
} | |
exports.normalizeBool = normalizeBool; | |
function isJsObject(o) { | |
return o !== null && (typeof o === "function" || typeof o === "object"); | |
} | |
exports.isJsObject = isJsObject; | |
function print(obj) { | |
console.log(obj); | |
} | |
exports.print = print; | |
var Json = (function() { | |
function Json() {} | |
Json.parse = function(s) { | |
return _global.JSON.parse(s); | |
}; | |
Json.stringify = function(data) { | |
return _global.JSON.stringify(data, null, 2); | |
}; | |
return Json; | |
})(); | |
exports.Json = Json; | |
var DateWrapper = (function() { | |
function DateWrapper() {} | |
DateWrapper.create = function(year, month, day, hour, minutes, seconds, milliseconds) { | |
if (month === void 0) { | |
month = 1; | |
} | |
if (day === void 0) { | |
day = 1; | |
} | |
if (hour === void 0) { | |
hour = 0; | |
} | |
if (minutes === void 0) { | |
minutes = 0; | |
} | |
if (seconds === void 0) { | |
seconds = 0; | |
} | |
if (milliseconds === void 0) { | |
milliseconds = 0; | |
} | |
return new exports.Date(year, month - 1, day, hour, minutes, seconds, milliseconds); | |
}; | |
DateWrapper.fromISOString = function(str) { | |
return new exports.Date(str); | |
}; | |
DateWrapper.fromMillis = function(ms) { | |
return new exports.Date(ms); | |
}; | |
DateWrapper.toMillis = function(date) { | |
return date.getTime(); | |
}; | |
DateWrapper.now = function() { | |
return new exports.Date(); | |
}; | |
DateWrapper.toJson = function(date) { | |
return date.toJSON(); | |
}; | |
return DateWrapper; | |
})(); | |
exports.DateWrapper = DateWrapper; | |
function setValueOnPath(global, path, value) { | |
var parts = path.split('.'); | |
var obj = global; | |
while (parts.length > 1) { | |
var name = parts.shift(); | |
if (obj.hasOwnProperty(name) && isPresent(obj[name])) { | |
obj = obj[name]; | |
} else { | |
obj = obj[name] = {}; | |
} | |
} | |
if (obj === undefined || obj === null) { | |
obj = {}; | |
} | |
obj[parts.shift()] = value; | |
} | |
exports.setValueOnPath = setValueOnPath; | |
var _symbolIterator = null; | |
function getSymbolIterator() { | |
if (isBlank(_symbolIterator)) { | |
if (isPresent(Symbol) && isPresent(Symbol.iterator)) { | |
_symbolIterator = Symbol.iterator; | |
} else { | |
var keys = Object.getOwnPropertyNames(Map.prototype); | |
for (var i = 0; i < keys.length; ++i) { | |
var key = keys[i]; | |
if (key !== 'entries' && key !== 'size' && Map.prototype[key] === Map.prototype['entries']) { | |
_symbolIterator = key; | |
} | |
} | |
} | |
} | |
return _symbolIterator; | |
} | |
exports.getSymbolIterator = getSymbolIterator; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/di/metadata", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var InjectMetadata = (function() { | |
function InjectMetadata(token) { | |
this.token = token; | |
} | |
InjectMetadata.prototype.toString = function() { | |
return "@Inject(" + lang_1.stringify(this.token) + ")"; | |
}; | |
InjectMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], InjectMetadata); | |
return InjectMetadata; | |
})(); | |
exports.InjectMetadata = InjectMetadata; | |
var OptionalMetadata = (function() { | |
function OptionalMetadata() {} | |
OptionalMetadata.prototype.toString = function() { | |
return "@Optional()"; | |
}; | |
OptionalMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], OptionalMetadata); | |
return OptionalMetadata; | |
})(); | |
exports.OptionalMetadata = OptionalMetadata; | |
var DependencyMetadata = (function() { | |
function DependencyMetadata() {} | |
Object.defineProperty(DependencyMetadata.prototype, "token", { | |
get: function() { | |
return null; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
DependencyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], DependencyMetadata); | |
return DependencyMetadata; | |
})(); | |
exports.DependencyMetadata = DependencyMetadata; | |
var InjectableMetadata = (function() { | |
function InjectableMetadata() {} | |
InjectableMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], InjectableMetadata); | |
return InjectableMetadata; | |
})(); | |
exports.InjectableMetadata = InjectableMetadata; | |
var SelfMetadata = (function() { | |
function SelfMetadata() {} | |
SelfMetadata.prototype.toString = function() { | |
return "@Self()"; | |
}; | |
SelfMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], SelfMetadata); | |
return SelfMetadata; | |
})(); | |
exports.SelfMetadata = SelfMetadata; | |
var SkipSelfMetadata = (function() { | |
function SkipSelfMetadata() {} | |
SkipSelfMetadata.prototype.toString = function() { | |
return "@SkipSelf()"; | |
}; | |
SkipSelfMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], SkipSelfMetadata); | |
return SkipSelfMetadata; | |
})(); | |
exports.SkipSelfMetadata = SkipSelfMetadata; | |
var HostMetadata = (function() { | |
function HostMetadata() {} | |
HostMetadata.prototype.toString = function() { | |
return "@Host()"; | |
}; | |
HostMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], HostMetadata); | |
return HostMetadata; | |
})(); | |
exports.HostMetadata = HostMetadata; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/util/decorators", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
function extractAnnotation(annotation) { | |
if (lang_1.isFunction(annotation) && annotation.hasOwnProperty('annotation')) { | |
annotation = annotation.annotation; | |
} | |
return annotation; | |
} | |
function applyParams(fnOrArray, key) { | |
if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || fnOrArray === Number || fnOrArray === Array) { | |
throw new Error("Can not use native " + lang_1.stringify(fnOrArray) + " as constructor"); | |
} | |
if (lang_1.isFunction(fnOrArray)) { | |
return fnOrArray; | |
} else if (fnOrArray instanceof Array) { | |
var annotations = fnOrArray; | |
var fn = fnOrArray[fnOrArray.length - 1]; | |
if (!lang_1.isFunction(fn)) { | |
throw new Error("Last position of Class method array must be Function in key " + key + " was '" + lang_1.stringify(fn) + "'"); | |
} | |
var annoLength = annotations.length - 1; | |
if (annoLength != fn.length) { | |
throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + lang_1.stringify(fn)); | |
} | |
var paramsAnnotations = []; | |
for (var i = 0, | |
ii = annotations.length - 1; i < ii; i++) { | |
var paramAnnotations = []; | |
paramsAnnotations.push(paramAnnotations); | |
var annotation = annotations[i]; | |
if (annotation instanceof Array) { | |
for (var j = 0; j < annotation.length; j++) { | |
paramAnnotations.push(extractAnnotation(annotation[j])); | |
} | |
} else if (lang_1.isFunction(annotation)) { | |
paramAnnotations.push(extractAnnotation(annotation)); | |
} else { | |
paramAnnotations.push(annotation); | |
} | |
} | |
Reflect.defineMetadata('parameters', paramsAnnotations, fn); | |
return fn; | |
} else { | |
throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + lang_1.stringify(fnOrArray) + "'"); | |
} | |
} | |
function Class(clsDef) { | |
var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); | |
var proto = constructor.prototype; | |
if (clsDef.hasOwnProperty('extends')) { | |
if (lang_1.isFunction(clsDef.extends)) { | |
constructor.prototype = proto = Object.create(clsDef.extends.prototype); | |
} else { | |
throw new Error("Class definition 'extends' property must be a constructor function was: " + lang_1.stringify(clsDef.extends)); | |
} | |
} | |
for (var key in clsDef) { | |
if (key != 'extends' && key != 'prototype' && clsDef.hasOwnProperty(key)) { | |
proto[key] = applyParams(clsDef[key], key); | |
} | |
} | |
if (this && this.annotations instanceof Array) { | |
Reflect.defineMetadata('annotations', this.annotations, constructor); | |
} | |
return constructor; | |
} | |
exports.Class = Class; | |
var Reflect = lang_1.global.Reflect; | |
if (!(Reflect && Reflect.getMetadata)) { | |
throw 'reflect-metadata shim is required when using class decorators'; | |
} | |
function makeDecorator(annotationCls, chainFn) { | |
if (chainFn === void 0) { | |
chainFn = null; | |
} | |
function DecoratorFactory(objOrType) { | |
var annotationInstance = new annotationCls(objOrType); | |
if (this instanceof annotationCls) { | |
return annotationInstance; | |
} else { | |
var chainAnnotation = lang_1.isFunction(this) && this.annotations instanceof Array ? this.annotations : []; | |
chainAnnotation.push(annotationInstance); | |
var TypeDecorator = function TypeDecorator(cls) { | |
var annotations = Reflect.getOwnMetadata('annotations', cls); | |
annotations = annotations || []; | |
annotations.push(annotationInstance); | |
Reflect.defineMetadata('annotations', annotations, cls); | |
return cls; | |
}; | |
TypeDecorator.annotations = chainAnnotation; | |
TypeDecorator.Class = Class; | |
if (chainFn) | |
chainFn(TypeDecorator); | |
return TypeDecorator; | |
} | |
} | |
DecoratorFactory.prototype = Object.create(annotationCls.prototype); | |
return DecoratorFactory; | |
} | |
exports.makeDecorator = makeDecorator; | |
function makeParamDecorator(annotationCls) { | |
function ParamDecoratorFactory() { | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i - 0] = arguments[_i]; | |
} | |
var annotationInstance = Object.create(annotationCls.prototype); | |
annotationCls.apply(annotationInstance, args); | |
if (this instanceof annotationCls) { | |
return annotationInstance; | |
} else { | |
ParamDecorator.annotation = annotationInstance; | |
return ParamDecorator; | |
} | |
function ParamDecorator(cls, unusedKey, index) { | |
var parameters = Reflect.getMetadata('parameters', cls); | |
parameters = parameters || []; | |
while (parameters.length <= index) { | |
parameters.push(null); | |
} | |
parameters[index] = parameters[index] || []; | |
var annotationsForParam = parameters[index]; | |
annotationsForParam.push(annotationInstance); | |
Reflect.defineMetadata('parameters', parameters, cls); | |
return cls; | |
} | |
} | |
ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype); | |
return ParamDecoratorFactory; | |
} | |
exports.makeParamDecorator = makeParamDecorator; | |
function makePropDecorator(decoratorCls) { | |
function PropDecoratorFactory() { | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i - 0] = arguments[_i]; | |
} | |
var decoratorInstance = Object.create(decoratorCls.prototype); | |
decoratorCls.apply(decoratorInstance, args); | |
if (this instanceof decoratorCls) { | |
return decoratorInstance; | |
} else { | |
return function PropDecorator(target, name) { | |
var meta = Reflect.getOwnMetadata('propMetadata', target.constructor); | |
meta = meta || {}; | |
meta[name] = meta[name] || []; | |
meta[name].unshift(decoratorInstance); | |
Reflect.defineMetadata('propMetadata', meta, target.constructor); | |
}; | |
} | |
} | |
PropDecoratorFactory.prototype = Object.create(decoratorCls.prototype); | |
return PropDecoratorFactory; | |
} | |
exports.makePropDecorator = makePropDecorator; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/di/forward_ref", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
function forwardRef(forwardRefFn) { | |
forwardRefFn.__forward_ref__ = forwardRef; | |
forwardRefFn.toString = function() { | |
return lang_1.stringify(this()); | |
}; | |
return forwardRefFn; | |
} | |
exports.forwardRef = forwardRef; | |
function resolveForwardRef(type) { | |
if (lang_1.isFunction(type) && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) { | |
return type(); | |
} else { | |
return type; | |
} | |
} | |
exports.resolveForwardRef = resolveForwardRef; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
exports.Map = lang_1.global.Map; | |
exports.Set = lang_1.global.Set; | |
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); | |
}); | |
}; | |
} | |
})(); | |
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; | |
var StringMapWrapper = (function() { | |
function StringMapWrapper() {} | |
StringMapWrapper.create = function() { | |
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.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() {} | |
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; | |
}; | |
return ListWrapper; | |
})(); | |
exports.ListWrapper = ListWrapper; | |
function isListLikeIterable(obj) { | |
if (!lang_1.isJsObject(obj)) | |
return false; | |
return lang_1.isArray(obj) || (!(obj instanceof exports.Map) && lang_1.getSymbolIterator() in obj); | |
} | |
exports.isListLikeIterable = isListLikeIterable; | |
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; | |
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; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/facade/exception_handler", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
var collection_1 = require("angular2/src/facade/collection"); | |
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; | |
})(); | |
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(); | |
if (this._rethrowException) | |
throw exception; | |
}; | |
ExceptionHandler.prototype._extractMessage = function(exception) { | |
return exception instanceof exceptions_1.WrappedException ? exception.wrapperMessage : exception.toString(); | |
}; | |
ExceptionHandler.prototype._longStackTrace = function(stackTrace) { | |
return collection_1.isListLikeIterable(stackTrace) ? stackTrace.join("\n\n-----async gap-----\n") : stackTrace.toString(); | |
}; | |
ExceptionHandler.prototype._findContext = function(exception) { | |
try { | |
if (!(exception instanceof exceptions_1.WrappedException)) | |
return null; | |
return lang_1.isPresent(exception.context) ? exception.context : this._findContext(exception.originalException); | |
} catch (e) { | |
return null; | |
} | |
}; | |
ExceptionHandler.prototype._findOriginalException = function(exception) { | |
if (!(exception instanceof exceptions_1.WrappedException)) | |
return null; | |
var e = exception.originalException; | |
while (e instanceof exceptions_1.WrappedException && lang_1.isPresent(e.originalException)) { | |
e = e.originalException; | |
} | |
return e; | |
}; | |
ExceptionHandler.prototype._findOriginalStack = function(exception) { | |
if (!(exception instanceof exceptions_1.WrappedException)) | |
return null; | |
var e = exception; | |
var stack = exception.originalStack; | |
while (e instanceof exceptions_1.WrappedException && lang_1.isPresent(e.originalException)) { | |
e = e.originalException; | |
if (e instanceof exceptions_1.WrappedException && lang_1.isPresent(e.originalException)) { | |
stack = e.originalStack; | |
} | |
} | |
return stack; | |
}; | |
return ExceptionHandler; | |
})(); | |
exports.ExceptionHandler = ExceptionHandler; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/reflection/reflector", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
var collection_1 = require("angular2/src/facade/collection"); | |
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; | |
var Reflector = (function() { | |
function Reflector(reflectionCapabilities) { | |
this._injectableInfo = new collection_1.Map(); | |
this._getters = new collection_1.Map(); | |
this._setters = new collection_1.Map(); | |
this._methods = new collection_1.Map(); | |
this._usedKeys = null; | |
this.reflectionCapabilities = reflectionCapabilities; | |
} | |
Reflector.prototype.isReflectionEnabled = function() { | |
return this.reflectionCapabilities.isReflectionEnabled(); | |
}; | |
Reflector.prototype.trackUsage = function() { | |
this._usedKeys = new collection_1.Set(); | |
}; | |
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); | |
} | |
}; | |
Reflector.prototype._getReflectionInfo = function(typeOrFunc) { | |
if (lang_1.isPresent(this._usedKeys)) { | |
this._usedKeys.add(typeOrFunc); | |
} | |
return this._injectableInfo.get(typeOrFunc); | |
}; | |
Reflector.prototype._containsReflectionInfo = function(typeOrFunc) { | |
return this._injectableInfo.has(typeOrFunc); | |
}; | |
Reflector.prototype.importUri = function(type) { | |
return this.reflectionCapabilities.importUri(type); | |
}; | |
return Reflector; | |
})(); | |
exports.Reflector = Reflector; | |
function _mergeMaps(target, config) { | |
collection_1.StringMapWrapper.forEach(config, function(v, k) { | |
return target.set(k, v); | |
}); | |
} | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/reflection/reflection_capabilities", ["angular2/src/facade/lang", "angular2/src/facade/exceptions"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
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"); | |
}; | |
ReflectionCapabilities.prototype._zipTypesAndAnnotaions = 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++) { | |
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) { | |
if (lang_1.isPresent(typeOrFunc.parameters)) { | |
return typeOrFunc.parameters; | |
} | |
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._zipTypesAndAnnotaions(paramTypes, paramAnnotations); | |
} | |
} | |
var parameters = new Array(typeOrFunc.length); | |
parameters.fill(undefined); | |
return parameters; | |
}; | |
ReflectionCapabilities.prototype.annotations = function(typeOrFunc) { | |
if (lang_1.isPresent(typeOrFunc.annotations)) { | |
var annotations = typeOrFunc.annotations; | |
if (lang_1.isFunction(annotations) && annotations.annotations) { | |
annotations = annotations.annotations; | |
} | |
return annotations; | |
} | |
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) { | |
if (lang_1.isPresent(typeOrFunc.propMetadata)) { | |
var propMetadata = typeOrFunc.propMetadata; | |
if (lang_1.isFunction(propMetadata) && propMetadata.propMetadata) { | |
propMetadata = propMetadata.propMetadata; | |
} | |
return propMetadata; | |
} | |
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); | |
}; | |
ReflectionCapabilities.prototype.importUri = function(type) { | |
return './'; | |
}; | |
return ReflectionCapabilities; | |
})(); | |
exports.ReflectionCapabilities = ReflectionCapabilities; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/di/type_literal", [], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var TypeLiteral = (function() { | |
function TypeLiteral() {} | |
Object.defineProperty(TypeLiteral.prototype, "type", { | |
get: function() { | |
throw new Error("Type literals are only supported in Dart"); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
return TypeLiteral; | |
})(); | |
exports.TypeLiteral = TypeLiteral; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/di/exceptions", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/exceptions"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
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 = require("angular2/src/facade/collection"); | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
function findFirstClosedCycle(keys) { | |
var res = []; | |
for (var i = 0; i < keys.length; ++i) { | |
if (collection_1.ListWrapper.contains(res, keys[i])) { | |
res.push(keys[i]); | |
return res; | |
} else { | |
res.push(keys[i]); | |
} | |
} | |
return res; | |
} | |
function constructResolvingPath(keys) { | |
if (keys.length > 1) { | |
var reversed = findFirstClosedCycle(collection_1.ListWrapper.reversed(keys)); | |
var tokenStrs = reversed.map(function(k) { | |
return lang_1.stringify(k.token); | |
}); | |
return " (" + tokenStrs.join(' -> ') + ")"; | |
} else { | |
return ""; | |
} | |
} | |
var AbstractProviderError = (function(_super) { | |
__extends(AbstractProviderError, _super); | |
function AbstractProviderError(injector, key, constructResolvingMessage) { | |
_super.call(this, "DI Exception"); | |
this.keys = [key]; | |
this.injectors = [injector]; | |
this.constructResolvingMessage = constructResolvingMessage; | |
this.message = this.constructResolvingMessage(this.keys); | |
} | |
AbstractProviderError.prototype.addKey = function(injector, key) { | |
this.injectors.push(injector); | |
this.keys.push(key); | |
this.message = this.constructResolvingMessage(this.keys); | |
}; | |
Object.defineProperty(AbstractProviderError.prototype, "context", { | |
get: function() { | |
return this.injectors[this.injectors.length - 1].debugContext(); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
return AbstractProviderError; | |
})(exceptions_1.BaseException); | |
exports.AbstractProviderError = AbstractProviderError; | |
var NoProviderError = (function(_super) { | |
__extends(NoProviderError, _super); | |
function NoProviderError(injector, key) { | |
_super.call(this, injector, key, function(keys) { | |
var first = lang_1.stringify(collection_1.ListWrapper.first(keys).token); | |
return "No provider for " + first + "!" + constructResolvingPath(keys); | |
}); | |
} | |
return NoProviderError; | |
})(AbstractProviderError); | |
exports.NoProviderError = NoProviderError; | |
var CyclicDependencyError = (function(_super) { | |
__extends(CyclicDependencyError, _super); | |
function CyclicDependencyError(injector, key) { | |
_super.call(this, injector, key, function(keys) { | |
return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys); | |
}); | |
} | |
return CyclicDependencyError; | |
})(AbstractProviderError); | |
exports.CyclicDependencyError = CyclicDependencyError; | |
var InstantiationError = (function(_super) { | |
__extends(InstantiationError, _super); | |
function InstantiationError(injector, originalException, originalStack, key) { | |
_super.call(this, "DI Exception", originalException, originalStack, null); | |
this.keys = [key]; | |
this.injectors = [injector]; | |
} | |
InstantiationError.prototype.addKey = function(injector, key) { | |
this.injectors.push(injector); | |
this.keys.push(key); | |
}; | |
Object.defineProperty(InstantiationError.prototype, "wrapperMessage", { | |
get: function() { | |
var first = lang_1.stringify(collection_1.ListWrapper.first(this.keys).token); | |
return "Error during instantiation of " + first + "!" + constructResolvingPath(this.keys) + "."; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(InstantiationError.prototype, "causeKey", { | |
get: function() { | |
return this.keys[0]; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(InstantiationError.prototype, "context", { | |
get: function() { | |
return this.injectors[this.injectors.length - 1].debugContext(); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
return InstantiationError; | |
})(exceptions_1.WrappedException); | |
exports.InstantiationError = InstantiationError; | |
var InvalidProviderError = (function(_super) { | |
__extends(InvalidProviderError, _super); | |
function InvalidProviderError(provider) { | |
_super.call(this, "Invalid provider - only instances of Provider and Type are allowed, got: " + provider.toString()); | |
} | |
return InvalidProviderError; | |
})(exceptions_1.BaseException); | |
exports.InvalidProviderError = InvalidProviderError; | |
var NoAnnotationError = (function(_super) { | |
__extends(NoAnnotationError, _super); | |
function NoAnnotationError(typeOrFunc, params) { | |
_super.call(this, NoAnnotationError._genMessage(typeOrFunc, params)); | |
} | |
NoAnnotationError._genMessage = function(typeOrFunc, params) { | |
var signature = []; | |
for (var i = 0, | |
ii = params.length; i < ii; i++) { | |
var parameter = params[i]; | |
if (lang_1.isBlank(parameter) || parameter.length == 0) { | |
signature.push('?'); | |
} else { | |
signature.push(parameter.map(lang_1.stringify).join(' ')); | |
} | |
} | |
return "Cannot resolve all parameters for " + lang_1.stringify(typeOrFunc) + "(" + signature.join(', ') + "). " + 'Make sure they all have valid type or annotations.'; | |
}; | |
return NoAnnotationError; | |
})(exceptions_1.BaseException); | |
exports.NoAnnotationError = NoAnnotationError; | |
var OutOfBoundsError = (function(_super) { | |
__extends(OutOfBoundsError, _super); | |
function OutOfBoundsError(index) { | |
_super.call(this, "Index " + index + " is out-of-bounds."); | |
} | |
return OutOfBoundsError; | |
})(exceptions_1.BaseException); | |
exports.OutOfBoundsError = OutOfBoundsError; | |
var MixingMultiProvidersWithRegularProvidersError = (function(_super) { | |
__extends(MixingMultiProvidersWithRegularProvidersError, _super); | |
function MixingMultiProvidersWithRegularProvidersError(provider1, provider2) { | |
_super.call(this, "Cannot mix multi providers and regular providers, got: " + provider1.toString() + " " + provider2.toString()); | |
} | |
return MixingMultiProvidersWithRegularProvidersError; | |
})(exceptions_1.BaseException); | |
exports.MixingMultiProvidersWithRegularProvidersError = MixingMultiProvidersWithRegularProvidersError; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/di/opaque_token", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var OpaqueToken = (function() { | |
function OpaqueToken(_desc) { | |
this._desc = _desc; | |
} | |
OpaqueToken.prototype.toString = function() { | |
return "Token " + this._desc; | |
}; | |
OpaqueToken = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], OpaqueToken); | |
return OpaqueToken; | |
})(); | |
exports.OpaqueToken = OpaqueToken; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/animate/css_animation_options", [], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var CssAnimationOptions = (function() { | |
function CssAnimationOptions() { | |
this.classesToAdd = []; | |
this.classesToRemove = []; | |
this.animationClasses = []; | |
} | |
return CssAnimationOptions; | |
})(); | |
exports.CssAnimationOptions = CssAnimationOptions; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/facade/math", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
exports.Math = lang_1.global.Math; | |
exports.NaN = typeof exports.NaN; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/platform/dom/util", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var CAMEL_CASE_REGEXP = /([A-Z])/g; | |
var DASH_CASE_REGEXP = /-([a-z])/g; | |
function camelCaseToDashCase(input) { | |
return lang_1.StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, function(m) { | |
return '-' + m[1].toLowerCase(); | |
}); | |
} | |
exports.camelCaseToDashCase = camelCaseToDashCase; | |
function dashCaseToCamelCase(input) { | |
return lang_1.StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP, function(m) { | |
return m[1].toUpperCase(); | |
}); | |
} | |
exports.dashCaseToCamelCase = dashCaseToCamelCase; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/facade/math", "angular2/src/platform/dom/dom_adapter"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var di_1 = require("angular2/src/core/di"); | |
var math_1 = require("angular2/src/facade/math"); | |
var dom_adapter_1 = require("angular2/src/platform/dom/dom_adapter"); | |
var BrowserDetails = (function() { | |
function BrowserDetails() { | |
this.elapsedTimeIncludesDelay = false; | |
this.doesElapsedTimeIncludesDelay(); | |
} | |
BrowserDetails.prototype.doesElapsedTimeIncludesDelay = function() { | |
var _this = this; | |
var div = dom_adapter_1.DOM.createElement('div'); | |
dom_adapter_1.DOM.setAttribute(div, 'style', "position: absolute; top: -9999px; left: -9999px; width: 1px;\n height: 1px; transition: all 1ms linear 1ms;"); | |
this.raf(function(timestamp) { | |
dom_adapter_1.DOM.on(div, 'transitionend', function(event) { | |
var elapsed = math_1.Math.round(event.elapsedTime * 1000); | |
_this.elapsedTimeIncludesDelay = elapsed == 2; | |
dom_adapter_1.DOM.remove(div); | |
}); | |
dom_adapter_1.DOM.setStyle(div, 'width', '2px'); | |
}, 2); | |
}; | |
BrowserDetails.prototype.raf = function(callback, frames) { | |
if (frames === void 0) { | |
frames = 1; | |
} | |
var queue = new RafQueue(callback, frames); | |
return function() { | |
return queue.cancel(); | |
}; | |
}; | |
BrowserDetails = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserDetails); | |
return BrowserDetails; | |
})(); | |
exports.BrowserDetails = BrowserDetails; | |
var RafQueue = (function() { | |
function RafQueue(callback, frames) { | |
this.callback = callback; | |
this.frames = frames; | |
this._raf(); | |
} | |
RafQueue.prototype._raf = function() { | |
var _this = this; | |
this.currentFrameId = dom_adapter_1.DOM.requestAnimationFrame(function(timestamp) { | |
return _this._nextFrame(timestamp); | |
}); | |
}; | |
RafQueue.prototype._nextFrame = function(timestamp) { | |
this.frames--; | |
if (this.frames > 0) { | |
this._raf(); | |
} else { | |
this.callback(timestamp); | |
} | |
}; | |
RafQueue.prototype.cancel = function() { | |
dom_adapter_1.DOM.cancelAnimationFrame(this.currentFrameId); | |
this.currentFrameId = null; | |
}; | |
return RafQueue; | |
})(); | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/platform/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var di_1 = require("angular2/src/core/di"); | |
var lang_1 = require("angular2/src/facade/lang"); | |
exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var lang_1 = require("angular2/src/facade/lang"); | |
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; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/metadata/di", ["angular2/src/facade/lang", "angular2/src/core/di", "angular2/src/core/di/metadata"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
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 __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var di_1 = require("angular2/src/core/di"); | |
var metadata_1 = require("angular2/src/core/di/metadata"); | |
var AttributeMetadata = (function(_super) { | |
__extends(AttributeMetadata, _super); | |
function AttributeMetadata(attributeName) { | |
_super.call(this); | |
this.attributeName = attributeName; | |
} | |
Object.defineProperty(AttributeMetadata.prototype, "token", { | |
get: function() { | |
return this; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
AttributeMetadata.prototype.toString = function() { | |
return "@Attribute(" + lang_1.stringify(this.attributeName) + ")"; | |
}; | |
AttributeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], AttributeMetadata); | |
return AttributeMetadata; | |
})(metadata_1.DependencyMetadata); | |
exports.AttributeMetadata = AttributeMetadata; | |
var QueryMetadata = (function(_super) { | |
__extends(QueryMetadata, _super); | |
function QueryMetadata(_selector, _a) { | |
var _b = _a === void 0 ? {} : _a, | |
_c = _b.descendants, | |
descendants = _c === void 0 ? false : _c, | |
_d = _b.first, | |
first = _d === void 0 ? false : _d; | |
_super.call(this); | |
this._selector = _selector; | |
this.descendants = descendants; | |
this.first = first; | |
} | |
Object.defineProperty(QueryMetadata.prototype, "isViewQuery", { | |
get: function() { | |
return false; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(QueryMetadata.prototype, "selector", { | |
get: function() { | |
return di_1.resolveForwardRef(this._selector); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(QueryMetadata.prototype, "isVarBindingQuery", { | |
get: function() { | |
return lang_1.isString(this.selector); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(QueryMetadata.prototype, "varBindings", { | |
get: function() { | |
return this.selector.split(','); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
QueryMetadata.prototype.toString = function() { | |
return "@Query(" + lang_1.stringify(this.selector) + ")"; | |
}; | |
QueryMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], QueryMetadata); | |
return QueryMetadata; | |
})(metadata_1.DependencyMetadata); | |
exports.QueryMetadata = QueryMetadata; | |
var ContentChildrenMetadata = (function(_super) { | |
__extends(ContentChildrenMetadata, _super); | |
function ContentChildrenMetadata(_selector, _a) { | |
var _b = (_a === void 0 ? {} : _a).descendants, | |
descendants = _b === void 0 ? false : _b; | |
_super.call(this, _selector, {descendants: descendants}); | |
} | |
ContentChildrenMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], ContentChildrenMetadata); | |
return ContentChildrenMetadata; | |
})(QueryMetadata); | |
exports.ContentChildrenMetadata = ContentChildrenMetadata; | |
var ContentChildMetadata = (function(_super) { | |
__extends(ContentChildMetadata, _super); | |
function ContentChildMetadata(_selector) { | |
_super.call(this, _selector, { | |
descendants: true, | |
first: true | |
}); | |
} | |
ContentChildMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ContentChildMetadata); | |
return ContentChildMetadata; | |
})(QueryMetadata); | |
exports.ContentChildMetadata = ContentChildMetadata; | |
var ViewQueryMetadata = (function(_super) { | |
__extends(ViewQueryMetadata, _super); | |
function ViewQueryMetadata(_selector, _a) { | |
var _b = _a === void 0 ? {} : _a, | |
_c = _b.descendants, | |
descendants = _c === void 0 ? false : _c, | |
_d = _b.first, | |
first = _d === void 0 ? false : _d; | |
_super.call(this, _selector, { | |
descendants: descendants, | |
first: first | |
}); | |
} | |
Object.defineProperty(ViewQueryMetadata.prototype, "isViewQuery", { | |
get: function() { | |
return true; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
ViewQueryMetadata.prototype.toString = function() { | |
return "@ViewQuery(" + lang_1.stringify(this.selector) + ")"; | |
}; | |
ViewQueryMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], ViewQueryMetadata); | |
return ViewQueryMetadata; | |
})(QueryMetadata); | |
exports.ViewQueryMetadata = ViewQueryMetadata; | |
var ViewChildrenMetadata = (function(_super) { | |
__extends(ViewChildrenMetadata, _super); | |
function ViewChildrenMetadata(_selector) { | |
_super.call(this, _selector, {descendants: true}); | |
} | |
ViewChildrenMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewChildrenMetadata); | |
return ViewChildrenMetadata; | |
})(ViewQueryMetadata); | |
exports.ViewChildrenMetadata = ViewChildrenMetadata; | |
var ViewChildMetadata = (function(_super) { | |
__extends(ViewChildMetadata, _super); | |
function ViewChildMetadata(_selector) { | |
_super.call(this, _selector, { | |
descendants: true, | |
first: true | |
}); | |
} | |
ViewChildMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewChildMetadata); | |
return ViewChildMetadata; | |
})(ViewQueryMetadata); | |
exports.ViewChildMetadata = ViewChildMetadata; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
var collection_1 = require("angular2/src/facade/collection"); | |
var di_1 = require("angular2/src/core/di"); | |
var IterableDiffers = (function() { | |
function IterableDiffers(factories) { | |
this.factories = factories; | |
} | |
IterableDiffers.create = function(factories, parent) { | |
if (lang_1.isPresent(parent)) { | |
var copied = collection_1.ListWrapper.clone(parent.factories); | |
factories = factories.concat(copied); | |
return new IterableDiffers(factories); | |
} else { | |
return new IterableDiffers(factories); | |
} | |
}; | |
IterableDiffers.extend = function(factories) { | |
return new di_1.Provider(IterableDiffers, { | |
useFactory: function(parent) { | |
if (lang_1.isBlank(parent)) { | |
throw new exceptions_1.BaseException('Cannot extend IterableDiffers without a parent injector'); | |
} | |
return IterableDiffers.create(factories, parent); | |
}, | |
deps: [[IterableDiffers, new di_1.SkipSelfMetadata(), new di_1.OptionalMetadata()]] | |
}); | |
}; | |
IterableDiffers.prototype.find = function(iterable) { | |
var factory = this.factories.find(function(f) { | |
return f.supports(iterable); | |
}); | |
if (lang_1.isPresent(factory)) { | |
return factory; | |
} else { | |
throw new exceptions_1.BaseException("Cannot find a differ supporting object '" + iterable + "'"); | |
} | |
}; | |
IterableDiffers = __decorate([di_1.Injectable(), lang_1.CONST(), __metadata('design:paramtypes', [Array])], IterableDiffers); | |
return IterableDiffers; | |
})(); | |
exports.IterableDiffers = IterableDiffers; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/change_detection/differs/default_iterable_differ", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection", "angular2/src/facade/lang"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
var collection_1 = require("angular2/src/facade/collection"); | |
var lang_2 = require("angular2/src/facade/lang"); | |
var DefaultIterableDifferFactory = (function() { | |
function DefaultIterableDifferFactory() {} | |
DefaultIterableDifferFactory.prototype.supports = function(obj) { | |
return collection_1.isListLikeIterable(obj); | |
}; | |
DefaultIterableDifferFactory.prototype.create = function(cdRef) { | |
return new DefaultIterableDiffer(); | |
}; | |
DefaultIterableDifferFactory = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], DefaultIterableDifferFactory); | |
return DefaultIterableDifferFactory; | |
})(); | |
exports.DefaultIterableDifferFactory = DefaultIterableDifferFactory; | |
var DefaultIterableDiffer = (function() { | |
function DefaultIterableDiffer() { | |
this._collection = null; | |
this._length = null; | |
this._linkedRecords = null; | |
this._unlinkedRecords = null; | |
this._previousItHead = null; | |
this._itHead = null; | |
this._itTail = null; | |
this._additionsHead = null; | |
this._additionsTail = null; | |
this._movesHead = null; | |
this._movesTail = null; | |
this._removalsHead = null; | |
this._removalsTail = null; | |
} | |
Object.defineProperty(DefaultIterableDiffer.prototype, "collection", { | |
get: function() { | |
return this._collection; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DefaultIterableDiffer.prototype, "length", { | |
get: function() { | |
return this._length; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
DefaultIterableDiffer.prototype.forEachItem = function(fn) { | |
var record; | |
for (record = this._itHead; record !== null; record = record._next) { | |
fn(record); | |
} | |
}; | |
DefaultIterableDiffer.prototype.forEachPreviousItem = function(fn) { | |
var record; | |
for (record = this._previousItHead; record !== null; record = record._nextPrevious) { | |
fn(record); | |
} | |
}; | |
DefaultIterableDiffer.prototype.forEachAddedItem = function(fn) { | |
var record; | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
fn(record); | |
} | |
}; | |
DefaultIterableDiffer.prototype.forEachMovedItem = function(fn) { | |
var record; | |
for (record = this._movesHead; record !== null; record = record._nextMoved) { | |
fn(record); | |
} | |
}; | |
DefaultIterableDiffer.prototype.forEachRemovedItem = function(fn) { | |
var record; | |
for (record = this._removalsHead; record !== null; record = record._nextRemoved) { | |
fn(record); | |
} | |
}; | |
DefaultIterableDiffer.prototype.diff = function(collection) { | |
if (lang_2.isBlank(collection)) | |
collection = []; | |
if (!collection_1.isListLikeIterable(collection)) { | |
throw new exceptions_1.BaseException("Error trying to diff '" + collection + "'"); | |
} | |
if (this.check(collection)) { | |
return this; | |
} else { | |
return null; | |
} | |
}; | |
DefaultIterableDiffer.prototype.onDestroy = function() {}; | |
DefaultIterableDiffer.prototype.check = function(collection) { | |
var _this = this; | |
this._reset(); | |
var record = this._itHead; | |
var mayBeDirty = false; | |
var index; | |
var item; | |
if (lang_2.isArray(collection)) { | |
var list = collection; | |
this._length = collection.length; | |
for (index = 0; index < this._length; index++) { | |
item = list[index]; | |
if (record === null || !lang_2.looseIdentical(record.item, item)) { | |
record = this._mismatch(record, item, index); | |
mayBeDirty = true; | |
} else if (mayBeDirty) { | |
record = this._verifyReinsertion(record, item, index); | |
} | |
record = record._next; | |
} | |
} else { | |
index = 0; | |
collection_1.iterateListLike(collection, function(item) { | |
if (record === null || !lang_2.looseIdentical(record.item, item)) { | |
record = _this._mismatch(record, item, index); | |
mayBeDirty = true; | |
} else if (mayBeDirty) { | |
record = _this._verifyReinsertion(record, item, index); | |
} | |
record = record._next; | |
index++; | |
}); | |
this._length = index; | |
} | |
this._truncate(record); | |
this._collection = collection; | |
return this.isDirty; | |
}; | |
Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", { | |
get: function() { | |
return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
DefaultIterableDiffer.prototype._reset = function() { | |
if (this.isDirty) { | |
var record; | |
var nextRecord; | |
for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { | |
record._nextPrevious = record._next; | |
} | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
record.previousIndex = record.currentIndex; | |
} | |
this._additionsHead = this._additionsTail = null; | |
for (record = this._movesHead; record !== null; record = nextRecord) { | |
record.previousIndex = record.currentIndex; | |
nextRecord = record._nextMoved; | |
} | |
this._movesHead = this._movesTail = null; | |
this._removalsHead = this._removalsTail = null; | |
} | |
}; | |
DefaultIterableDiffer.prototype._mismatch = function(record, item, index) { | |
var previousRecord; | |
if (record === null) { | |
previousRecord = this._itTail; | |
} else { | |
previousRecord = record._prev; | |
this._remove(record); | |
} | |
record = this._linkedRecords === null ? null : this._linkedRecords.get(item, index); | |
if (record !== null) { | |
this._moveAfter(record, previousRecord, index); | |
} else { | |
record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); | |
if (record !== null) { | |
this._reinsertAfter(record, previousRecord, index); | |
} else { | |
record = this._addAfter(new CollectionChangeRecord(item), previousRecord, index); | |
} | |
} | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._verifyReinsertion = function(record, item, index) { | |
var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); | |
if (reinsertRecord !== null) { | |
record = this._reinsertAfter(reinsertRecord, record._prev, index); | |
} else if (record.currentIndex != index) { | |
record.currentIndex = index; | |
this._addToMoves(record, index); | |
} | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._truncate = function(record) { | |
while (record !== null) { | |
var nextRecord = record._next; | |
this._addToRemovals(this._unlink(record)); | |
record = nextRecord; | |
} | |
if (this._unlinkedRecords !== null) { | |
this._unlinkedRecords.clear(); | |
} | |
if (this._additionsTail !== null) { | |
this._additionsTail._nextAdded = null; | |
} | |
if (this._movesTail !== null) { | |
this._movesTail._nextMoved = null; | |
} | |
if (this._itTail !== null) { | |
this._itTail._next = null; | |
} | |
if (this._removalsTail !== null) { | |
this._removalsTail._nextRemoved = null; | |
} | |
}; | |
DefaultIterableDiffer.prototype._reinsertAfter = function(record, prevRecord, index) { | |
if (this._unlinkedRecords !== null) { | |
this._unlinkedRecords.remove(record); | |
} | |
var prev = record._prevRemoved; | |
var next = record._nextRemoved; | |
if (prev === null) { | |
this._removalsHead = next; | |
} else { | |
prev._nextRemoved = next; | |
} | |
if (next === null) { | |
this._removalsTail = prev; | |
} else { | |
next._prevRemoved = prev; | |
} | |
this._insertAfter(record, prevRecord, index); | |
this._addToMoves(record, index); | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._moveAfter = function(record, prevRecord, index) { | |
this._unlink(record); | |
this._insertAfter(record, prevRecord, index); | |
this._addToMoves(record, index); | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._addAfter = function(record, prevRecord, index) { | |
this._insertAfter(record, prevRecord, index); | |
if (this._additionsTail === null) { | |
this._additionsTail = this._additionsHead = record; | |
} else { | |
this._additionsTail = this._additionsTail._nextAdded = record; | |
} | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._insertAfter = function(record, prevRecord, index) { | |
var next = prevRecord === null ? this._itHead : prevRecord._next; | |
record._next = next; | |
record._prev = prevRecord; | |
if (next === null) { | |
this._itTail = record; | |
} else { | |
next._prev = record; | |
} | |
if (prevRecord === null) { | |
this._itHead = record; | |
} else { | |
prevRecord._next = record; | |
} | |
if (this._linkedRecords === null) { | |
this._linkedRecords = new _DuplicateMap(); | |
} | |
this._linkedRecords.put(record); | |
record.currentIndex = index; | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._remove = function(record) { | |
return this._addToRemovals(this._unlink(record)); | |
}; | |
DefaultIterableDiffer.prototype._unlink = function(record) { | |
if (this._linkedRecords !== null) { | |
this._linkedRecords.remove(record); | |
} | |
var prev = record._prev; | |
var next = record._next; | |
if (prev === null) { | |
this._itHead = next; | |
} else { | |
prev._next = next; | |
} | |
if (next === null) { | |
this._itTail = prev; | |
} else { | |
next._prev = prev; | |
} | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._addToMoves = function(record, toIndex) { | |
if (record.previousIndex === toIndex) { | |
return record; | |
} | |
if (this._movesTail === null) { | |
this._movesTail = this._movesHead = record; | |
} else { | |
this._movesTail = this._movesTail._nextMoved = record; | |
} | |
return record; | |
}; | |
DefaultIterableDiffer.prototype._addToRemovals = function(record) { | |
if (this._unlinkedRecords === null) { | |
this._unlinkedRecords = new _DuplicateMap(); | |
} | |
this._unlinkedRecords.put(record); | |
record.currentIndex = null; | |
record._nextRemoved = null; | |
if (this._removalsTail === null) { | |
this._removalsTail = this._removalsHead = record; | |
record._prevRemoved = null; | |
} else { | |
record._prevRemoved = this._removalsTail; | |
this._removalsTail = this._removalsTail._nextRemoved = record; | |
} | |
return record; | |
}; | |
DefaultIterableDiffer.prototype.toString = function() { | |
var record; | |
var list = []; | |
for (record = this._itHead; record !== null; record = record._next) { | |
list.push(record); | |
} | |
var previous = []; | |
for (record = this._previousItHead; record !== null; record = record._nextPrevious) { | |
previous.push(record); | |
} | |
var additions = []; | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
additions.push(record); | |
} | |
var moves = []; | |
for (record = this._movesHead; record !== null; record = record._nextMoved) { | |
moves.push(record); | |
} | |
var removals = []; | |
for (record = this._removalsHead; record !== null; record = record._nextRemoved) { | |
removals.push(record); | |
} | |
return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; | |
}; | |
return DefaultIterableDiffer; | |
})(); | |
exports.DefaultIterableDiffer = DefaultIterableDiffer; | |
var CollectionChangeRecord = (function() { | |
function CollectionChangeRecord(item) { | |
this.item = item; | |
this.currentIndex = null; | |
this.previousIndex = null; | |
this._nextPrevious = null; | |
this._prev = null; | |
this._next = null; | |
this._prevDup = null; | |
this._nextDup = null; | |
this._prevRemoved = null; | |
this._nextRemoved = null; | |
this._nextAdded = null; | |
this._nextMoved = null; | |
} | |
CollectionChangeRecord.prototype.toString = function() { | |
return this.previousIndex === this.currentIndex ? lang_2.stringify(this.item) : lang_2.stringify(this.item) + '[' + lang_2.stringify(this.previousIndex) + '->' + lang_2.stringify(this.currentIndex) + ']'; | |
}; | |
return CollectionChangeRecord; | |
})(); | |
exports.CollectionChangeRecord = CollectionChangeRecord; | |
var _DuplicateItemRecordList = (function() { | |
function _DuplicateItemRecordList() { | |
this._head = null; | |
this._tail = null; | |
} | |
_DuplicateItemRecordList.prototype.add = function(record) { | |
if (this._head === null) { | |
this._head = this._tail = record; | |
record._nextDup = null; | |
record._prevDup = null; | |
} else { | |
this._tail._nextDup = record; | |
record._prevDup = this._tail; | |
record._nextDup = null; | |
this._tail = record; | |
} | |
}; | |
_DuplicateItemRecordList.prototype.get = function(item, afterIndex) { | |
var record; | |
for (record = this._head; record !== null; record = record._nextDup) { | |
if ((afterIndex === null || afterIndex < record.currentIndex) && lang_2.looseIdentical(record.item, item)) { | |
return record; | |
} | |
} | |
return null; | |
}; | |
_DuplicateItemRecordList.prototype.remove = function(record) { | |
var prev = record._prevDup; | |
var next = record._nextDup; | |
if (prev === null) { | |
this._head = next; | |
} else { | |
prev._nextDup = next; | |
} | |
if (next === null) { | |
this._tail = prev; | |
} else { | |
next._prevDup = prev; | |
} | |
return this._head === null; | |
}; | |
return _DuplicateItemRecordList; | |
})(); | |
var _DuplicateMap = (function() { | |
function _DuplicateMap() { | |
this.map = new Map(); | |
} | |
_DuplicateMap.prototype.put = function(record) { | |
var key = lang_2.getMapKey(record.item); | |
var duplicates = this.map.get(key); | |
if (!lang_2.isPresent(duplicates)) { | |
duplicates = new _DuplicateItemRecordList(); | |
this.map.set(key, duplicates); | |
} | |
duplicates.add(record); | |
}; | |
_DuplicateMap.prototype.get = function(value, afterIndex) { | |
if (afterIndex === void 0) { | |
afterIndex = null; | |
} | |
var key = lang_2.getMapKey(value); | |
var recordList = this.map.get(key); | |
return lang_2.isBlank(recordList) ? null : recordList.get(value, afterIndex); | |
}; | |
_DuplicateMap.prototype.remove = function(record) { | |
var key = lang_2.getMapKey(record.item); | |
var recordList = this.map.get(key); | |
if (recordList.remove(record)) { | |
this.map.delete(key); | |
} | |
return record; | |
}; | |
Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { | |
get: function() { | |
return this.map.size === 0; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
_DuplicateMap.prototype.clear = function() { | |
this.map.clear(); | |
}; | |
_DuplicateMap.prototype.toString = function() { | |
return '_DuplicateMap(' + lang_2.stringify(this.map) + ')'; | |
}; | |
return _DuplicateMap; | |
})(); | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/change_detection/differs/keyvalue_differs", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
var collection_1 = require("angular2/src/facade/collection"); | |
var di_1 = require("angular2/src/core/di"); | |
var KeyValueDiffers = (function() { | |
function KeyValueDiffers(factories) { | |
this.factories = factories; | |
} | |
KeyValueDiffers.create = function(factories, parent) { | |
if (lang_1.isPresent(parent)) { | |
var copied = collection_1.ListWrapper.clone(parent.factories); | |
factories = factories.concat(copied); | |
return new KeyValueDiffers(factories); | |
} else { | |
return new KeyValueDiffers(factories); | |
} | |
}; | |
KeyValueDiffers.extend = function(factories) { | |
return new di_1.Provider(KeyValueDiffers, { | |
useFactory: function(parent) { | |
if (lang_1.isBlank(parent)) { | |
throw new exceptions_1.BaseException('Cannot extend KeyValueDiffers without a parent injector'); | |
} | |
return KeyValueDiffers.create(factories, parent); | |
}, | |
deps: [[KeyValueDiffers, new di_1.SkipSelfMetadata(), new di_1.OptionalMetadata()]] | |
}); | |
}; | |
KeyValueDiffers.prototype.find = function(kv) { | |
var factory = this.factories.find(function(f) { | |
return f.supports(kv); | |
}); | |
if (lang_1.isPresent(factory)) { | |
return factory; | |
} else { | |
throw new exceptions_1.BaseException("Cannot find a differ supporting object '" + kv + "'"); | |
} | |
}; | |
KeyValueDiffers = __decorate([di_1.Injectable(), lang_1.CONST(), __metadata('design:paramtypes', [Array])], KeyValueDiffers); | |
return KeyValueDiffers; | |
})(); | |
exports.KeyValueDiffers = KeyValueDiffers; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/change_detection/differs/default_keyvalue_differ", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/exceptions"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { | |
var c = arguments.length, | |
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | |
d; | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | |
r = Reflect.decorate(decorators, target, key, desc); | |
else | |
for (var i = decorators.length - 1; i >= 0; i--) | |
if (d = decorators[i]) | |
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
return c > 3 && r && Object.defineProperty(target, key, r), r; | |
}; | |
var __metadata = (this && this.__metadata) || function(k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | |
return Reflect.metadata(k, v); | |
}; | |
var collection_1 = require("angular2/src/facade/collection"); | |
var lang_1 = require("angular2/src/facade/lang"); | |
var exceptions_1 = require("angular2/src/facade/exceptions"); | |
var DefaultKeyValueDifferFactory = (function() { | |
function DefaultKeyValueDifferFactory() {} | |
DefaultKeyValueDifferFactory.prototype.supports = function(obj) { | |
return obj instanceof Map || lang_1.isJsObject(obj); | |
}; | |
DefaultKeyValueDifferFactory.prototype.create = function(cdRef) { | |
return new DefaultKeyValueDiffer(); | |
}; | |
DefaultKeyValueDifferFactory = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], DefaultKeyValueDifferFactory); | |
return DefaultKeyValueDifferFactory; | |
})(); | |
exports.DefaultKeyValueDifferFactory = DefaultKeyValueDifferFactory; | |
var DefaultKeyValueDiffer = (function() { | |
function DefaultKeyValueDiffer() { | |
this._records = new Map(); | |
this._mapHead = null; | |
this._previousMapHead = null; | |
this._changesHead = null; | |
this._changesTail = null; | |
this._additionsHead = null; | |
this._additionsTail = null; | |
this._removalsHead = null; | |
this._removalsTail = null; | |
} | |
Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", { | |
get: function() { | |
return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
DefaultKeyValueDiffer.prototype.forEachItem = function(fn) { | |
var record; | |
for (record = this._mapHead; record !== null; record = record._next) { | |
fn(record); | |
} | |
}; | |
DefaultKeyValueDiffer.prototype.forEachPreviousItem = function(fn) { | |
var record; | |
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { | |
fn(record); | |
} | |
}; | |
DefaultKeyValueDiffer.prototype.forEachChangedItem = function(fn) { | |
var record; | |
for (record = this._changesHead; record !== null; record = record._nextChanged) { | |
fn(record); | |
} | |
}; | |
DefaultKeyValueDiffer.prototype.forEachAddedItem = function(fn) { | |
var record; | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
fn(record); | |
} | |
}; | |
DefaultKeyValueDiffer.prototype.forEachRemovedItem = function(fn) { | |
var record; | |
for (record = this._removalsHead; record !== null; record = record._nextRemoved) { | |
fn(record); | |
} | |
}; | |
DefaultKeyValueDiffer.prototype.diff = function(map) { | |
if (lang_1.isBlank(map)) | |
map = collection_1.MapWrapper.createFromPairs([]); | |
if (!(map instanceof Map || lang_1.isJsObject(map))) { | |
throw new exceptions_1.BaseException("Error trying to diff '" + map + "'"); | |
} | |
if (this.check(map)) { | |
return this; | |
} else { | |
return null; | |
} | |
}; | |
DefaultKeyValueDiffer.prototype.onDestroy = function() {}; | |
DefaultKeyValueDiffer.prototype.check = function(map) { | |
var _this = this; | |
this._reset(); | |
var records = this._records; | |
var oldSeqRecord = this._mapHead; | |
var lastOldSeqRecord = null; | |
var lastNewSeqRecord = null; | |
var seqChanged = false; | |
this._forEach(map, function(value, key) { | |
var newSeqRecord; | |
if (oldSeqRecord !== null && key === oldSeqRecord.key) { | |
newSeqRecord = oldSeqRecord; | |
if (!lang_1.looseIdentical(value, oldSeqRecord.currentValue)) { | |
oldSeqRecord.previousValue = oldSeqRecord.currentValue; | |
oldSeqRecord.currentValue = value; | |
_this._addToChanges(oldSeqRecord); | |
} | |
} else { | |
seqChanged = true; | |
if (oldSeqRecord !== null) { | |
oldSeqRecord._next = null; | |
_this._removeFromSeq(lastOldSeqRecord, oldSeqRecord); | |
_this._addToRemovals(oldSeqRecord); | |
} | |
if (records.has(key)) { | |
newSeqRecord = records.get(key); | |
} else { | |
newSeqRecord = new KVChangeRecord(key); | |
records.set(key, newSeqRecord); | |
newSeqRecord.currentValue = value; | |
_this._addToAdditions(newSeqRecord); | |
} | |
} | |
if (seqChanged) { | |
if (_this._isInRemovals(newSeqRecord)) { | |
_this._removeFromRemovals(newSeqRecord); | |
} | |
if (lastNewSeqRecord == null) { | |
_this._mapHead = newSeqRecord; | |
} else { | |
lastNewSeqRecord._next = newSeqRecord; | |
} | |
} | |
lastOldSeqRecord = oldSeqRecord; | |
lastNewSeqRecord = newSeqRecord; | |
oldSeqRecord = oldSeqRecord === null ? null : oldSeqRecord._next; | |
}); | |
this._truncate(lastOldSeqRecord, oldSeqRecord); | |
return this.isDirty; | |
}; | |
DefaultKeyValueDiffer.prototype._reset = function() { | |
if (this.isDirty) { | |
var record; | |
for (record = this._previousMapHead = this._mapHead; record !== null; record = record._next) { | |
record._nextPrevious = record._next; | |
} | |
for (record = this._changesHead; record !== null; record = record._nextChanged) { | |
record.previousValue = record.currentValue; | |
} | |
for (record = this._additionsHead; record != null; record = record._nextAdded) { | |
record.previousValue = record.currentValue; | |
} | |
this._changesHead = this._changesTail = null; | |
this._additionsHead = this._additionsTail = null; | |
this._removalsHead = this._removalsTail = null; | |
} | |
}; | |
DefaultKeyValueDiffer.prototype._truncate = function(lastRecord, record) { | |
while (record !== null) { | |
if (lastRecord === null) { | |
this._mapHead = null; | |
} else { | |
lastRecord._next = null; | |
} | |
var nextRecord = record._next; | |
this._addToRemovals(record); | |
lastRecord = record; | |
record = nextRecord; | |
} | |
for (var rec = this._removalsHead; rec !== null; rec = rec._nextRemoved) { | |
rec.previousValue = rec.currentValue; | |
rec.currentValue = null; | |
this._records.delete(rec.key); | |
} | |
}; | |
DefaultKeyValueDiffer.prototype._isInRemovals = function(record) { | |
return record === this._removalsHead || record._nextRemoved !== null || record._prevRemoved !== null; | |
}; | |
DefaultKeyValueDiffer.prototype._addToRemovals = function(record) { | |
if (this._removalsHead === null) { | |
this._removalsHead = this._removalsTail = record; | |
} else { | |
this._removalsTail._nextRemoved = record; | |
record._prevRemoved = this._removalsTail; | |
this._removalsTail = record; | |
} | |
}; | |
DefaultKeyValueDiffer.prototype._removeFromSeq = function(prev, record) { | |
var next = record._next; | |
if (prev === null) { | |
this._mapHead = next; | |
} else { | |
prev._next = next; | |
} | |
}; | |
DefaultKeyValueDiffer.prototype._removeFromRemovals = function(record) { | |
var prev = record._prevRemoved; | |
var next = record._nextRemoved; | |
if (prev === null) { | |
this._removalsHead = next; | |
} else { | |
prev._nextRemoved = next; | |
} | |
if (next === null) { | |
this._removalsTail = prev; | |
} else { | |
next._prevRemoved = prev; | |
} | |
record._prevRemoved = record._nextRemoved = null; | |
}; | |
DefaultKeyValueDiffer.prototype._addToAdditions = function(record) { | |
if (this._additionsHead === null) { | |
this._additionsHead = this._additionsTail = record; | |
} else { | |
this._additionsTail._nextAdded = record; | |
this._additionsTail = record; | |
} | |
}; | |
DefaultKeyValueDiffer.prototype._addToChanges = function(record) { | |
if (this._changesHead === null) { | |
this._changesHead = this._changesTail = record; | |
} else { | |
this._changesTail._nextChanged = record; | |
this._changesTail = record; | |
} | |
}; | |
DefaultKeyValueDiffer.prototype.toString = function() { | |
var items = []; | |
var previous = []; | |
var changes = []; | |
var additions = []; | |
var removals = []; | |
var record; | |
for (record = this._mapHead; record !== null; record = record._next) { | |
items.push(lang_1.stringify(record)); | |
} | |
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { | |
previous.push(lang_1.stringify(record)); | |
} | |
for (record = this._changesHead; record !== null; record = record._nextChanged) { | |
changes.push(lang_1.stringify(record)); | |
} | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
additions.push(lang_1.stringify(record)); | |
} | |
for (record = this._removalsHead; record !== null; record = record._nextRemoved) { | |
removals.push(lang_1.stringify(record)); | |
} | |
return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; | |
}; | |
DefaultKeyValueDiffer.prototype._forEach = function(obj, fn) { | |
if (obj instanceof Map) { | |
obj.forEach(fn); | |
} else { | |
collection_1.StringMapWrapper.forEach(obj, fn); | |
} | |
}; | |
return DefaultKeyValueDiffer; | |
})(); | |
exports.DefaultKeyValueDiffer = DefaultKeyValueDiffer; | |
var KVChangeRecord = (function() { | |
function KVChangeRecord(key) { | |
this.key = key; | |
this.previousValue = null; | |
this.currentValue = null; | |
this._nextPrevious = null; | |
this._next = null; | |
this._nextAdded = null; | |
this._nextRemoved = null; | |
this._prevRemoved = null; | |
this._nextChanged = null; | |
} | |
KVChangeRecord.prototype.toString = function() { | |
return lang_1.looseIdentical(this.previousValue, this.currentValue) ? lang_1.stringify(this.key) : (lang_1.stringify(this.key) + '[' + lang_1.stringify(this.previousValue) + '->' + lang_1.stringify(this.currentValue) + ']'); | |
}; | |
return KVChangeRecord; | |
})(); | |
exports.KVChangeRecord = KVChangeRecord; | |
global.define = __define; | |
return module.exports; | |
}); | |
System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/facade/collection"], true, function(require, exports, module) { | |
var global = System.global, | |
__define = global.define; | |
global.define = undefined; | |
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 = require("angular2/src/facade/collection"); | |
var AST = (function() { | |
function AST() {} | |
AST.prototype.visit = function(visitor) { | |
return null; | |
}; | |
AST.prototype.toString = function() { | |
return "AST"; | |
}; | |
return AST; | |
})(); | |
exports.AST = AST; | |
var Quote = (function(_super) { | |
__extends(Quote, _super); | |
function Quote(prefix, uninterpretedExpression, location) { | |
_super.call(this); | |
this.prefix = prefix; | |
this.uninterpretedExpression = uninterpretedExpression; | |
this.location = location; | |
} | |
Quote.prototype.visit = function(visitor) { | |
return visitor.visitQuote(this); | |
}; | |
Quote.prototype.toString = function() { | |
return "Quote"; | |
}; | |
return Quote; | |
})(AST); | |
exports.Quote = Quote; | |
var EmptyExpr = (function(_super) { | |
__extends(EmptyExpr, _super); | |
function EmptyExpr() { | |
_super.apply(this, arguments); | |
} | |
EmptyExpr.prototype.visit = function(visitor) {}; | |
return EmptyExpr; | |
})(AST); | |
exports.EmptyExpr = EmptyExpr; | |
var ImplicitReceiver = (function(_super) { | |
__extends(ImplicitReceiver, _super); | |
function ImplicitReceiver() { | |
_super.apply(this, arguments); | |
} | |
ImplicitReceiver.prototype.visit = function(visitor) { | |
return visitor.visitImplicitReceiver(this); | |
}; | |
return ImplicitReceiver; | |
})(AST); | |
exports.ImplicitReceiver = ImplicitReceiver; | |
var Chain = (function(_super) { | |
__extends(Chain, _super); | |
function Chain(expressions) { | |
_super.call(this); | |
this.expressions = expressions; | |
} | |
Chain.prototype.visit = function(visitor) { | |
return visitor.visitChain(this); | |
}; | |
return Chain; | |
})(AST); | |
exports.Chain = Chain; | |
var Conditional = (function(_super) { | |
__extends(Conditional, _super); | |
function Conditional(condition, trueExp, falseExp) { | |
_super.call(this); | |
this.condition = condition; | |
this.trueExp = trueExp; | |
this.falseExp = falseExp; | |
} | |
Conditional.prototype.visit = function(visitor) { | |
return visitor.visitConditional(this); | |
}; | |
return Conditional; | |
})(AST); | |
exports.Conditional = Conditional; | |
var PropertyRead = (function(_super) { | |
__extends(PropertyRead, _super); | |
function PropertyRead(receiver, name, getter) { | |
_super.call(this); | |
this.receiver = receiver; | |
this.name = name; | |
this.getter = getter; | |
} | |
PropertyRead.prototype.visit = function(visitor) { | |
return visitor.visitPropertyRead(this); | |
}; | |
return PropertyRead; | |
})(AST); | |
exports.PropertyRead = PropertyRead; | |
var PropertyWrite = (function(_super) { | |
__extends(PropertyWrite, _super); | |
function PropertyWrite(receiver, name, setter, value) { | |
_super.call(this); | |
this.receiver = receiver; | |
this.name = name; | |
this.setter = setter; | |
this.value = value; | |
} | |
PropertyWrite.prototype.visit = function(visitor) { | |
return visitor.visitPropertyWrite(this); | |
}; | |
return PropertyWrite; | |
})(AST); | |
exports.PropertyWrite = PropertyWrite; | |
var SafePropertyRead = (function(_super) { | |
__extends(SafePropertyRead, _super); | |
function SafePropertyRead(receiver, name, getter) { | |
_super.call(this); | |
this.receiver = receiver; | |
this.name = name; | |
this.getter = getter; | |
} | |
SafePropertyRead.prototype.visit = function(visitor) { | |
return visitor.visitSafePropertyRead(this); | |
}; | |
return SafePropertyRead; | |
})(AST); | |
exports.SafePropertyRead = SafePropertyRead; | |
var KeyedRead = (function(_super) { | |
__extends(KeyedRead, _super); | |
function KeyedRead(obj, key) { | |
_super.call(this); | |
this.obj = obj; | |
this.key = key; | |
} | |
KeyedRead.prototype.visit = function(visitor) { | |
return visitor.visitKeyedRead(this); | |
}; | |
return KeyedRead; | |
})(AST); | |
exports.KeyedRead = KeyedRead; | |
var KeyedWrite = (function(_super) { | |
__extends(KeyedWrite, _super); | |
function KeyedWrite(obj, key, value) { | |
_super.call(this); | |
this.obj = obj; | |
this.key = key; | |
this.value = value; | |
} | |
KeyedWrite.prototype.visit = function(visitor) { | |
return visitor.visitKeyedWrite(this); | |
}; | |
return KeyedWrite; | |
})(AST); | |
exports.KeyedWrite = KeyedWrite; | |
var BindingPipe = (function(_super) { | |
__extends(BindingPipe, _super); | |
function BindingPipe(exp, name, args) { | |
_super.call(this); | |
this.exp = exp; | |
this.name = name; | |
this.args = args; | |
} | |
BindingPipe.prototype.visit = function(visitor) { | |
return visitor.visitPipe(this); | |
}; | |
return BindingPipe; | |
})(AST); | |
exports.BindingPipe = BindingPipe; | |
var LiteralPrimitive = (function(_super) { | |
__extends(LiteralPrimitive, _super); | |
function LiteralPrimitive(value) { | |
_super.call(this); | |
this.value = value; | |
} | |
LiteralPrimitive.prototype.visit = function(visitor) { | |
return visitor.visitLiteralPrimitive(this); | |
}; | |
return LiteralPrimitive; | |
})(AST); | |
exports.LiteralPrimitive = LiteralPrimitive; | |
var LiteralArray = (function(_super) { | |
__extends(LiteralArray, _super); | |
function LiteralArray(expressions) { | |
_super.call(this); | |
this.expressions = expressions; | |
} | |
LiteralArray.prototype.visit = function(visitor) { | |
return visitor.visitLiteralArray(this); | |
}; | |
return LiteralArray; | |
})(AST); | |
exports.LiteralArray = LiteralArray; | |
var LiteralMap = (function(_super) { | |